Skip to content

Disallow inserting two schemas under the same name #229

@fisx

Description

@fisx

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions