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

dereferencing an external schema doesn't need to change the object name #28

Open
steve-nay-sage opened this issue Nov 15, 2021 · 0 comments

Comments

@steve-nay-sage
Copy link

Summary

The goal of this issue is to improve how external schema references look when dereferenced. Currently, an external reference like this:

components:
  schemas:
    account:
      $ref: ../models/account..s1.schema.yaml

when dereferenced looks something like this:

components:
  schemas:
    account:
      $ref: '#/components/schemas/Account_S1_Schema'
    Account_S1_Schema
      title: Account
      type: object
      description: General Ledger Account
      properties:
      .
      .
      .

The original external reference gets replaced with a new internal reference to a new object that has a name that is derived from the external file name. It doesn't seem like it's necessary to create a new object, and it looks kind of silly. (It's functional, though.)

Instead, the external reference should just be replaced with the contents of the file that it points to:

components:
  schemas:
    account:
      title: Account
      type: object
      description: General Ledger Account
      properties:
      .
      .
      .

I think this would be an improvement to external references that originate in the components/schemas section. External references from the paths section would need to be treated differently because a new internal schema would need to be created. In that case, I recommend using the title of the object as the object name if the schema contains a title, and only using the file name if there is no title.

Additional context

I haven't used the JSON schema ref parser in its standalone form; I've only used it by exporting from Stoplight, and Stoplight support folks told me that this is the actual source project.

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