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

fix: nested refs #478

Closed
wants to merge 1 commit into from

Conversation

peter-mouland
Copy link
Contributor

@peter-mouland peter-mouland commented Sep 26, 2021

Start work towards #462

TBC:

  • how to handle ids/refs that arent modified using buildLocalReference?
    • Current behaviour t.equal(definitions['def-3'].properties.b.$ref, '#/definitions/schemaB'), vs
    • more correct t.equal(definitions['def-3'].properties.b.$ref, '#/definitions/def-2')?
  • de we need to code for key === 'examples' in the swagger spec?

Checklist

@peter-mouland peter-mouland changed the title fix: nested refs or swagger spec fix: nested refs Sep 26, 2021
if (key === '$ref') {
jsonSchema[key] = `#/definitions/${jsonSchema[key]}`
} else if (key === 'examples' && Array.isArray(jsonSchema[key]) && (jsonSchema[key].length > 1)) {
jsonSchema.examples = convertExamplesArrayToObject(jsonSchema.examples)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this case tested?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not at the moment, I'm not sure why the code is handing examples. Should it be tested, or removed?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We landed the #472 PR

is this needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd say, this PR is still needed as this PR takes care of both Swagger and OpenAPI, that otehr PR only takes care of OpenAPI?

Does another test need to be added for when the user does not tweak buildLocalReference, or is returning the $id now preferred?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

closed in favour of #479

@peter-mouland
Copy link
Contributor Author

closed in favour of #479

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.

2 participants