You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is not only confusing, but also makes it impossible to get the prefix back if I take the Reference out of a Referenced and try to render it back to JSON. Or dually, if I construct a Referenced with a Reference in it that has the prefix, it'll result in a malformed fragment specifier:
instanceToJSON (ReferencedSchema) where toJSON = referencedToJSON "#/components/schemas/"
instanceToJSON (ReferencedParam) where toJSON = referencedToJSON "#/components/parameters/"
instanceToJSON (ReferencedResponse) where toJSON = referencedToJSON "#/components/responses/"
instanceToJSON (ReferencedRequestBody) where toJSON = referencedToJSON "#/components/requestBodies/"
instanceToJSON (ReferencedExample) where toJSON = referencedToJSON "#/components/examples/"
instanceToJSON (ReferencedHeader) where toJSON = referencedToJSON "#/components/headers/"
instanceToJSON (ReferencedLink) where toJSON = referencedToJSON "#/components/links/"
instanceToJSON (ReferencedCallback) where toJSON = referencedToJSON "#/components/callbacks/"
And there's an analogous section for FromJSON elsewhere in the same file. IMO these instances should just do the obvious thing and forward to the appropriate instances on Reference; things like prefix stripping can be done elsewhere.
The text was updated successfully, but these errors were encountered:
Or even better: Reference should contain the type of component as an additional field (i.e. parsed from #/components/{type}/{name}), and the FromJSON instance for Referenced a can then still ensure that the Reference inside a Ref is to the right type of component.
This is not only confusing, but also makes it impossible to get the prefix back if I take the
Reference
out of aReferenced
and try to render it back to JSON. Or dually, if I construct aReferenced
with aReference
in it that has the prefix, it'll result in a malformed fragment specifier:For the
ToJSON
instances, the special casing is implemented here:openapi3/src/Data/OpenApi/Internal.hs
Lines 1427 to 1438 in efb9a50
And there's an analogous section for
FromJSON
elsewhere in the same file. IMO these instances should just do the obvious thing and forward to the appropriate instances onReference
; things like prefix stripping can be done elsewhere.The text was updated successfully, but these errors were encountered: