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

Support top-level references in components #97

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

isomorpheme
Copy link

@isomorpheme isomorpheme commented Apr 24, 2024

From how I understand the OpenAPI 3.0 spec, the following should be allowed and work as expected:

components:
  schemas:
    Foo:
      type: string
    Bar:
      $ref: '#/components/schemas/Foo'

but since type Definitions = InsOrdHashMap Text, which is in turn used in Components (without Referenced), this doesn't parse correctly. This PR changes Definitions so that a Referenced is added in between, and updates other code to deal with the new possibility of a Ref. This is of course a breaking change.

(One use case for writing specs like this is in Haskell code generation: in Chordify's internal tool, a schema that's just a ref to another schema is turned into a newtype of that schema.)

@isomorpheme isomorpheme marked this pull request as ready for review April 24, 2024 09:39
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

Successfully merging this pull request may close these issues.

1 participant