Skip to content

feat: add support for OpenAPI Overlay #1727

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

Merged
merged 2 commits into from
Aug 20, 2024
Merged

feat: add support for OpenAPI Overlay #1727

merged 2 commits into from
Aug 20, 2024

Conversation

jamietanna
Copy link
Member

@jamietanna jamietanna commented Aug 16, 2024

In the past, users wishing to override specific configuration, for
instance taking advantage of extensions such as x-go-type would need
to modify the OpenAPI specification they are using.

In a lot of cases, this OpenAPI specification would be produced by a
different team to the consumers (or even a different company) and so
asking them to make changes like this were unreasonable.

This would lead to the API consumers needing to vendor the specification
from the producer (which is our recommendation anyway) and then make any
number of local changes to the specification to make it generate code
that looks reasonable.

However, in the case that a consumer would update their specification,
they would likely end up with a number of merge conflicts.

With these changes, it is now possible to make changes to the input
OpenAPI specification without needing to modify it directly.

This takes advantage of the OpenAPI Overlay specification0, which is a
stable specification, and is ready for wider implementation.

This uses Speakeasy's implementation, which is noted as an "alpha"
implementation.

We introduce a new function, LoadSwaggerWithOverlay, which performs
the wrangling of the Overlay on top of the specification we're pointing
to, and make sure we wire in the ability to configure the path, as well
as whether we want to relax the "strict" validation the Overlay library
provides.

Closes #1553.

@jamietanna jamietanna force-pushed the feature/overlays branch 5 times, most recently from 3869afb to 56f7dd4 Compare August 16, 2024 13:30
@jamietanna jamietanna changed the title feat: add support for OpenAPI Overlays feat: add support for OpenAPI Overlay Aug 16, 2024
@jamietanna jamietanna force-pushed the feature/overlays branch 2 times, most recently from 71545d6 to 86a2575 Compare August 16, 2024 13:45
@jamietanna jamietanna marked this pull request as ready for review August 16, 2024 13:46
@jamietanna jamietanna requested a review from a team as a code owner August 16, 2024 13:46
@jamietanna jamietanna added this to the v2.4.0 milestone Aug 19, 2024
In the past, users wishing to override specific configuration, for
instance taking advantage of extensions such as `x-go-type` would need
to modify the OpenAPI specification they are using.

In a lot of cases, this OpenAPI specification would be produced by a
different team to the consumers (or even a different company) and so
asking them to make changes like this were unreasonable.

This would lead to the API consumers needing to vendor the specification
from the producer (which is our recommendation anyway) and then make any
number of local changes to the specification to make it generate code
that looks reasonable.

However, in the case that a consumer would update their specification,
they would likely end up with a number of merge conflicts.

With these changes, it is now possible to make changes to the input
OpenAPI specification _without needing to modify it directly_.

This takes advantage of the OpenAPI Overlay specification[0], which is a
stable specification, and is ready for wider implementation.

This uses Speakeasy's implementation, which is noted as an "alpha"
implementation.

We introduce a new function, `LoadSwaggerWithOverlay`, which performs
the wrangling of the Overlay on top of the specification we're pointing
to, and make sure we wire in the ability to configure the path, as well
as whether we want to relax the "strict" validation the Overlay library
provides.

Closes #1553.

[0]: https://github.com/OAI/Overlay-Specification
As part of #1553.

This tries to cover a lot of the more complex cases.

Plus a fair bit of blurb + info to the README too.
@jamietanna jamietanna merged commit c66e13a into main Aug 20, 2024
26 checks passed
@jamietanna jamietanna deleted the feature/overlays branch August 20, 2024 11:45
@jamietanna jamietanna added enhancement New feature or request notable changes Used for release notes to highlight these more highly labels Aug 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request notable changes Used for release notes to highlight these more highly
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for OpenAPI overlays
1 participant
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy