feat: add openapi 3.1 support#49
Merged
Merged
Conversation
Nicholas Wiersma (nrwiersma)
approved these changes
Jun 25, 2026
There was a problem hiding this comment.
Pull request overview
Adds OpenAPI 3.1 output support to the spec generator by introducing an OpenAPIVersion option and upgrading generated documents to 3.1 semantics when requested, along with expanded golden-file coverage for both 3.0 and 3.1 outputs.
Changes:
- Add
SpecConfig.OpenAPIVersionand upgrade-to-3.1 flow usingopenapi3conv.Upgradewhen a 3.1.x version is requested. - Extend
TestBuildSpecto cover 3.0 vs 3.1 generation for different package-segment configurations. - Add new 3.1.0 golden spec outputs under
testdata/.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| gen.go | Adds configurable OpenAPI version selection and conditional 3.1 upgrade behavior. |
| gen_test.go | Refactors golden-file tests into a table and adds 3.1.0 coverage cases. |
| example_test.go | Pins example output to OpenAPI 3.0.0 explicitly via config. |
| testdata/spec-3.1.0.json | New 3.1.0 golden spec (pkg segment = 1) for test comparisons. |
| testdata/spec-pkgseg0-3.1.0.json | New 3.1.0 golden spec (pkg segment = 0) for test comparisons. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
Rafał Mnich (rafalmnich)
approved these changes
Jun 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Goal of this PR
Support openapi v3.1.0 support.
How did I test it?
Unit tests & use it with gf-core. See https://github.com/GameFabric/gf-core/pull/865 (that PR will be closed after this has been acknowledged).