-
Notifications
You must be signed in to change notification settings - Fork 6k
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: introduce symmetry to schema openapi generate-*
commands
#21790
Comments
Thanks for this! Couple of questions on the bumpiness and then I'll respond to the concerns.
The re: an overall generate command, I spoke with @Rugvip about something like this at KubeCon and I think it would be great. An interim step between now and then could be migrating the existing I'm not completely sold that this should sit in |
Not necessarily. I think that use case could be covered under
All of it.
In this case, we were creating a full-stack plugin from scratch. We started with the UI, created an OpenAPI schema for it, implemented the UI, generated types from the schema, and created the ApiRef, hooked it up to the component.
We did a bit of iterating. We updated the schema halfway through, then re-ran the generator and updated the typescript to get it to compile.
What were the issues?
Yeah, we don't need to worry about this right now. It might make sense to add generate to |
Oh yeah, true.
Ah sorry, my question here was were you using
Cool! 🚀
Mostly on the "generating a spec from test data" side. The whole flow is pretty bumpy and not something I tested out with the catalog when I was starting out. There are a couple of easy improvements and some longer term issues with how we're executing the subcommands.
Definitely a question for the core maintainers. If this tooling starts getting more traction, the caching is going to be really important. |
We were using the export directly. We didn't wrap it. The API Factory instantiated the class explored from the generated code.
Oh, I see. Hmm... I didn't try this at all. Is this using Optic? |
Oooo, cool, thoughts on the API? One object with
Yup, it's more for migrating/bootstrapping existing plugins to the tooling by generating a basic spec from test data sent locally using supertest. Really cool stuff. |
It's a bit weird but not too weird. Where does that format come from? I assumed it was OpenAPI Tools. Without looking at the generated types, I tried to pass path & query together, but then types told me otherwise. I would expect something like |
From conversation on the PR, I think mostly around API stability. My previous iteration was |
I assumed that conflicts are not possible. Does OpenAPI allow params with same names in path and query? |
Unfortunately yes, it's probably the weakest part of OpenAPI. Parameters are just an array of objects with an |
From looking at this, it seems like treacherous territory to combine them. We'd probably eventually regret this decision so let's forget that. |
fixes: #21790 Signed-off-by: Aramis <sennyeyaramis@gmail.com>
🔖 Feature description
backstage-repo-tools schema openapi generate
command operates on the entire repository and doesn't take any arguments.backstage-repo-tools schema openapi generate-client
expects a path to openapi schema and the root of the workspace where the code will be generated. This setup works fine if the development of the backend plugin starts before the frontend client. It's awkward if that work happens in parallel. It's not a significant issue, but making it feel more consistent would be nice.🎤 Context
I had the pleasure of showing the new OpenAPI generator functionality to developers in our workshop, and it was very well received. Updating the schema and re-generating the client felt very natural. I wanted to share some of the bumpy parts of the process so we could iron them out.
✌️ Possible Implementation
One possibility is to have a
package generate
command added to@backstage/cli
that would invokegenerate
on every workspace that defines the script. In the workspace, we could specifybackstage-repo-tools schema openapi generate client --input= --output=
orbackstage-repo-tools schema openapi generate server --input= ---output=
.👀 Have you spent some time to check if this feature request has been raised before?
🏢 Have you read the Code of Conduct?
Are you willing to submit PR?
Yes I am willing to submit a PR!
The text was updated successfully, but these errors were encountered: