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

OpenAPI 3.0 for openapi.yaml? #1729

Open
woodruffw opened this issue Oct 3, 2023 · 7 comments
Open

OpenAPI 3.0 for openapi.yaml? #1729

woodruffw opened this issue Oct 3, 2023 · 7 comments
Labels
enhancement New feature or request

Comments

@woodruffw
Copy link
Member

Description

The current openapi.yaml is written as OpenAPI 2.0 (a/k/a Swagger 2.0). There's a newer version (OpenAPI 3.0) that unifies the syntax a bit.

Context: This is part of a yak stack: I'm working on a Python library that will expose Rekor's API types as Python models so that we can easily integrate DSSE types into sigstore-python (sigstore/sigstore-python#628).

I'm using datamodel-codegen to build that model library, which in turn can't use the current OpenAPI spec for Rekor because it requires OpenAPI 3.0.

If there are no objections, then I'm happy to make these changes -- they'll hopefully be pretty small.

@woodruffw woodruffw added the enhancement New feature or request label Oct 3, 2023
@woodruffw
Copy link
Member Author

CC @bobcallaway and @haydentherapper (sorry if you're the wrong people to ping!)

@bobcallaway
Copy link
Member

The go-swagger codegen we use doesn't support it. If the changes are backward compatible, we'd be open to it.

@woodruffw
Copy link
Member Author

Yeah, just found go-swagger/go-swagger#1122. Oh well.

I spent a bit of time trying to mold the current OpenAPI definition into a 3.0 form, so I'll push that up as a draft PR. But as you note this probably isn't workable, so I'll find another path forwards on the Python side 🙂

@haydentherapper
Copy link
Contributor

Something else to explore is rebooting the effort to create a gRPC API (#771). We decided to hold off until a 2.0 API, but if there's interest now, we could take a look at shaping it based on the current API.

@woodruffw
Copy link
Member Author

Something else to explore is rebooting the effort to create a gRPC API (#771). We decided to hold off until a 2.0 API, but if there's interest now, we could take a look at shaping it based on the current API.

I think this would also solve my problem, based on my (maybe wrong?) understanding of gRPC: under gRPC, there'd be a set of protobuf definitions that I could generate Python models from, right?


Separately: it turns out that there is a public, official Swagger 2.0 to OpenAPI 3.0 REST API: https://converter.swagger.io/#/Converter/convertByUrl. I threw the current Rekor OpenAPI spec into that and it appeared to work; I'll see if it works for my use case.

@haydentherapper
Copy link
Contributor

I think this would also solve my problem, based on my (maybe wrong?) understanding of gRPC: under gRPC, there'd be a set of protobuf definitions that I could generate Python models from, right?

Correct! You could play around with calling Fulcio's gRPC API if you wanted to see how that worked.

@woodruffw
Copy link
Member Author

For visibility: here's the set of hacks I ultimately needed: https://github.com/trailofbits/sigstore-rekor-types/blob/main/codegen/codegen.sh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants