-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Proposal swag 2.0 using open api 3.0 #548
Comments
I would love this, we've been holding off on it at work because it's not OpenAPI 3. What's best for me to help? |
@superdave PR is always welcome. |
Would love this to get access to the |
Does it support OpenAPI Specification 3 now? |
nope. We'd need to switch to a spec lib that supports OpenAPI 3, if there is such a lib by now |
@Nerzal maybe just try https://github.com/getkin/kin-openapi |
I've found a way to generate openapi3 specs from the output of this project |
upppppppppppppppppppppppppppppppppppppp! |
Any progress with this? Except for workaround |
I don't think It will happen any time soon. |
i have a branch, where i refactore swaggo to use open api 3.0 specs, but will still take some weeks/months until it is finished, as i do not have that much time at hand to complete it |
We can't support this kind of change overnight. |
Could you share the branch? |
Still lots of work to do, but "soon" i'll have some time. https://github.com/Nerzal/swag/tree/feature/openapi3 Here is the comparison: |
@Nerzal How Can I help you to finish your work? |
Is there any alternative project which supports OpenAPI v3? I think we are way behind. |
@santosh eventually we should offer support on how to migrate from swag. |
I started a new attempt. I'm making pretty good progress here. |
I can make v2 branch for openapi v3 if you want. |
Sounds good. |
Done. Please make the PR against this branch https://github.com/swaggo/swag/tree/v2 |
Okay, i'll open a Work in Progress PR now. Some comments like host, basepath and some more do not exist anymore and need a new swag comment syntax. I'm currently working full time on this project, so that will happen pretty soon |
@Nerzal Let's keep it simple. This doesn't mean it has to be done in 1 single PR. |
would love anyOf to support multiple body schemas |
I guess we could call it an MVP as soon as response objects and request bodies are correctly parsed, which is what i am working on currently. My next step is Adding some Tests, as parsing a real world documentation while debugging tends to get pretty complicated. |
The first throw of the implementation is now on the V2 branch. It needs testing, feel free to report issues. I'll try to fix them |
v2.0.0-beta is avail for testing ... |
Hi, I see that a lot of work is being done to implement open API 3.0 specifications, (there are commits dating from last week on branch |
@Nerzal thanks for adding the ability to generate OpenAPI v3.1! Any plans to support generation of OpenAPI 3.0 spec? |
where can I find documentation on 3.1 generation? also how differently do I need to annotate / is it a smooth transition? |
Any progress on the spec 3.0 generation? |
I'd really appreciate if someone could write a blog post (or tutorial video) on how to use the latest v2 of swaggo/swag which uses OpenAPI v3? |
You can use the new version programmatically, e.g. package main
import (
"log"
"github.com/swaggo/swag/v2"
"github.com/swaggo/swag/v2/gen"
)
func main() {
err := gen.New().Build(&gen.Config{
SearchDir: "./",
MainAPIFile: "internal/v2/api/service.go",
PropNamingStrategy: swag.CamelCase,
OutputDir: "./docs",
OutputTypes: []string{"json", "yaml"},
ParseDependency: true,
// This is a swag/v2 field
GenerateOpenAPI3Doc: false,
ParseVendor: true,
})
if err != nil {
log.Fatalf("Failed to generate swagger.json err: %v", err)
}
} I suppose the new flag is also available on the cli, I just haven't tried that. As far as I could tell the new version converts v2 to v3 by using the same annotations but I found it buggy so far. |
It seems that development of OpenAPI v3.x has stalled out, is that so? Does anyone have alternative libraries that they can recommend to migrate to? |
I personally migrated to oapi-codegen. In my opinion, it is better to write the API specification first and then generate the interfaces on the server/clients based on it. For migration, I used the file generated by Swaggo as a basis to generate the interface. I started making my specification changes directly in the YAML file from that point onward. |
@Nerzal Any progress on the spec 3.0 generation? When is the expected release date for v2? |
@rattrayalex did you get any alternative library? |
I've heard good things about https://github.com/danielgtaylor/huma but haven't tried it myself. |
there is also such a framework that works with go 1.22 |
Hi guys. Is there any update on supporting open api 3.0? I believe that still the latest version doesn't support it |
Is there any update on this or will it not be supported? |
+1 |
Hey everyone.
As the support of Swagger 2.0 is pretty stable now, we should start to make a list of all features / changes we need to support Open Api 3.0.
We might create a new 2.0 milestone and move/create Open Api 3.0 support issues in there.
The text was updated successfully, but these errors were encountered: