-
-
Notifications
You must be signed in to change notification settings - Fork 954
Migrate to libopenapi #1388
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
base: main
Are you sure you want to change the base?
Migrate to libopenapi #1388
Conversation
125b654
to
6860428
Compare
Hey, thanks very much for this PR! This is something I'd started looking at in #1211 but put on hold. I'll try and have a look at it in a couple of weeks, as I'll need a bit of time to go through all the changes. Appreciate the hard work 🙌 |
I notice your email address isn't associated with your GitHub account - mind doing that, so it shows correctly in GitHub? (Right now 6860428 doesn't have your avatar next to it) |
6860428
to
09ae9ad
Compare
@jamietanna thanks for noticing. I was not aware of that, now I added my work email into my account and it shows my avatar. |
pkg/codegen/codegen.go
Outdated
@@ -103,7 +106,7 @@ func constructImportMapping(importMapping map[string]string) importMap { | |||
// Generate uses the Go templating engine to generate all of our server wrappers from | |||
// the descriptions we've built up above from the schema objects. | |||
// opts defines | |||
func Generate(spec *openapi3.T, opts Configuration) (string, error) { | |||
func Generate(spec *libopenapi.DocumentModel[v3.Document], opts Configuration) (string, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The codegen
package is used by external users, so this would be a breaking change - thoughts on how we could look at making this a non-breaking change? Perhaps introducing a new package i.e. pkg/codegen/openapi
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed the code to not to modify anything under pkg/* directories, instead created a new package under pkg/codegen/openapi
Labelling the implementation right now as breaking - we'll look at what we can do to make it non-breaking if possible 🤞 |
There's a failing test:
|
Any update on this? |
The issue is resolved now |
Hi! Is this PR still active? I was considering testing the branch as suggested by #373 (comment) |
Testing this branch, I run into this, however when doing 3.1.0 validation it shows these is a valid spec
It is basically error on these and saying these are the same? Even though one has a single _ and the other has two __ But then even removing these, It errors out again
Which seems like its because that struct type never got defined |
What's the best way to test this? I'm getting a lot of errors with compilation when overriding my go.mod file with a require and the local repo set to the correct branch:
gives a bunch of errors such as
|
Any plans to make a v3 tag with this breaking change? |
Answered in more depth in #373 (comment) |
This pull request is a complete migration to libopenapi. Almost the tests and examples generates the same code, except embedded swaggerSpec files. While semantically its the same, due to change of order of object keys in the Json, it generates a different gzipped base64.
There is only one tests that fails, which isinternal/test/issues/issue-removed-external-ref
. And I believe it's related to this: pb33f/libopenapi#219. I'm following/contributing to the thread to solve the issue.The generated code continues to use kin-api since validation logic depends on middleware repos, which still uses kin-api.
Test results:
The MR also includes regenerated
*.gen.go
files, so you can compare the difference.