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

Ensure embedded spec contains all necessary OpenAPI documents #771

Merged
merged 1 commit into from Oct 24, 2022

Conversation

jamietanna
Copy link
Collaborator

@jamietanna jamietanna commented Oct 3, 2022

When using a schema that uses $refs to an external file, although we
generate the mappings appropriately, this then leads to the embedded
spec being misaligned, as it continues to use the $ref to that
external file, which then is not available when calling i.e.
GetSwagger.

We can take advantage of the InternalizeRefs method to perform an
in-place modification to apply those external references into a single,
embeddable spec.

@jamietanna jamietanna marked this pull request as draft October 3, 2022 08:59
@jamietanna jamietanna marked this pull request as ready for review October 24, 2022 19:32
When using a schema that uses `$ref`s to an external file, although we
generate the mappings appropriately, this then leads to the embedded
spec being misaligned, as it continues to use the `$ref` to that
external file, which then is not available when calling i.e.
`GetSwagger`.

We can take advantage of the `InternalizeRefs` method to perform an
in-place modification to apply those external references into a single,
embeddable spec.

This appears to only work when a full file is referenced, instead of a
path within a file.
@jamietanna jamietanna merged commit 6364d85 into master Oct 24, 2022
@jamietanna jamietanna deleted the defect/embedded-spec branch October 24, 2022 20:12
adrianpk pushed a commit to foorester/oapi-codegen that referenced this pull request Jan 16, 2024
Ensure embedded spec contains all necessary OpenAPI documents
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant