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

Schema's loaded from other than requested file don't store location #2057

Open
maxlepikhin opened this issue Feb 21, 2024 · 0 comments
Open

Comments

@maxlepikhin
Copy link

setResolve(true) tells OpenAPIV3Parser to load specs from external locations and put them in the model.

  ParseOptions parseOptions = new ParseOptions();
  parseOptions.setResolve(true);
  OpenAPI openApiModel = new OpenAPIV3Parser().read(inputFile, null, parseOptions);

It is desirable to distinguish schemas loaded from external locations from the ones defined locally. For example:

  • errors.yaml may define shared error types.
  • api1.yaml and api2.yaml (that reference errors.yaml) may define two different APIs.
    Code generation for errors.yaml should only be done once.

On the other hand, api3.yaml may reference another file.yaml that must be resolved and included in the generated code for api3 unlike errors.yaml.

Proposal: store original reference in $originalRef next to $ref in SchemaProcessor.

This change will let code generators add custom logic for shared vs not schemas.

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