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

[feature proposal] OpenAPI Spec Generator #149

Open
serranoio opened this issue Feb 20, 2025 · 3 comments
Open

[feature proposal] OpenAPI Spec Generator #149

serranoio opened this issue Feb 20, 2025 · 3 comments

Comments

@serranoio
Copy link
Contributor

serranoio commented Feb 20, 2025

Do you know what the flying f**** comes through your API? Find out with this proposal!

Have wiretap live as a proxy and it will build an OpenAPI spec for you.

Inititial proposal

  1. Every http request proxied will have a new endpoint added in the spec (with everything added of course). It will have its response & request data added as examples.
  2. Any time the same endpoint encounters a different shape of data coming into the same endpoint, it will add the oneOf statement.
  3. Any time the same endpoint encounters the same shape of data, it will simply add another example.

Architecture

create NewSpecGeneratorService() and have wiretap build an OpenAPI spec for you as a proxy. It will send the built spec to the UI

The UI

Want to include a button on top that opens the generated spec in a drawer.

Out of scope

I do not plan on optimizing the spec.

  1. if there are multiple endpoints which return the same datatype, you can consolidate them into one datatype.

Questions

Vacuum fits in here somehow. Don't know how yet.
For part 3 of the initial proposal, I would love to include oneOf on the schema level & oneOf on the data type level
but don't know how to differentiate. (this is more so something I need to figure out myself)

In Scope

The initial proposal is all in scope. Of course, it will be fully tested so you can see exactly what I mean

Comments

This is all I need. Havent thought of anything more since I just thought of this today. Will come back and add on.

@daveshanley
Copy link
Member

This is a huge, huge undertaking. It's been on my radar for some time - this is not simple in any shape or form and I need you to understand that to do this right, it's a big, big investment.

@serranoio
Copy link
Contributor Author

Great! Let's do it! 😆 I'd love to jump in the deepend. However, I want to do the Automated Mock Generator proposal first

@LasneF
Copy link

LasneF commented Mar 4, 2025

@daveshanley as a source of inspiration this is a feature supported by useOptics
https://github.com/opticdev/optic/wiki/Using-Optic-Capture-with-HAR

or better this video (mostly not the beginning but the mid , and end , show casing interactive mode , or from scratch )
https://github.com/opticdev/optic/wiki/Using-Optic-Capture-with-Integration-Tests

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

No branches or pull requests

3 participants