Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disallow inserting two schemas under the same name #229

Open
fisx opened this issue Dec 10, 2021 · 0 comments
Open

Disallow inserting two schemas under the same name #229

fisx opened this issue Dec 10, 2021 · 0 comments

Comments

@fisx
Copy link
Collaborator

fisx commented Dec 10, 2021

I just fixed a mistake in our code that would have been nice to catch in the library: if you add the same name for a json schema twice in the same swagger document, it's almost certainly a mistake and should trigger an error.

Example (not tested):

instance ToSchema T1 where
  declareNamedSchema _ = pure $ NamedSchema (Just "T1") mempty

instance ToSchema T2 where
  declareNamedSchema _ = pure $ NamedSchema (Just "T1") mempty

The typo in T2 causes the two generated schemas to be stored under the same name, and one of them being overwritten. I think this should trigger an error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant