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
{{ message }}
Repository navigation
Why are the schemas different for ToParamSchema UUID and ToSchema UUID #94
While writing manual OpenApi instances for a phantom type wrapping UUID today, I noticed that (undeclare (declareNamedSchema (Proxy @UUID)))._namedSchemaSchema /= toParamSchema (Proxy @UUID), which I find surprising (not just for UUID but for any type).
instanceToParamSchemaUUIDwhere
toParamSchema _ =mempty& type_ ?~OpenApiString& format ?~"uuid"instanceToSchemaUUID.UUIDwhere
declareNamedSchema p =pure$ named "UUID"$ paramSchemaToSchema p
& example ?~ toJSON (UUID.toText UUID.nil)
Is there a reason why the example is only for ToSchema and not for ToParamSchema?
That looks like a bug to me.
I would expect the implementation to be
instanceToParamSchemaUUIDwhere
toParamSchema _ =mempty& type_ ?~OpenApiString& format ?~"uuid"& example ?~ toJSON (UUID.toText UUID.nil)
instanceToSchemaUUID.UUIDwhere
declareNamedSchema p =pure$ named "UUID"$ paramSchemaToSchema p
More generally, is there a scenario where (undeclare (declareNamedSchema (Proxy @a)))._namedSchemaSchema /= toParamSchema (Proxy @a) makes sense for any type a?
Activity