-
Notifications
You must be signed in to change notification settings - Fork 215
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
Generate models for all components in swagger.json #4835
Comments
Hi @IkeOTL |
Hi @baywet Or maybe I'm going about this the wrong way, do you have other suggestions? |
Thanks for the additional context I wouldn't say it's the wrong way, but maybe an unintended way. When we started out kiota the focus was very much clients for REST/HTTP APIs. Other protocols were never in scope. You might be able to generate those additional models, but are they going to serialize properly for the desired protocol? etc. |
Currently not webhooks. An example would be serializimg an object to JSON and sending it as message to an AWS SQS queue from one service, and polled from another service where it will deserialize into the object. And since I publish my client package in CI/CD it would be nice to have Kiota also harvest these objects from the swagger file since they're already there. I used to use NSwag, which did this, but I'd rather not use that anymore as it seems less future proof than Kiota |
Thanks for the additional context. I'll defer to @sebastienlevert on this one as the program manager. |
@baywet can you expand on the "update" scenarios and why it's not great? While this is a value of kiota (to trim components), it's something that brings a behavior that might be unexpected. Having something to turn it off would provide the capability while not breaking anybody. Now, environment variables vs. switches, I feel the problem is the same as now we're having bits of the customization on switches, and other bits in environment variables. To stay consistent, I would suggest we stick to a single customization option. |
@sebastienlevert it would be a problem for updates if we went the variable route.
Now all of a sudden a bunch of classes just disappeared. |
Yeah, we lose on idempotency because we wouldn't persist this, good point. So the CLI switch is really the only option... |
Assuming we went down that road, what would we call this switch? |
Maybe |
what about |
+1 |
@maisarissi since Seb is out, and since you've worked a lot with the CLI lately, what are your thoughts? |
I have never thought about an use case when one might want to generate all models, thanks for sharing @IkeOTL ! |
I don't see a benefit of generating the inline models for endpoints that are not selected. By nature, they are not reusable. |
Yes, I do agree that there is no benefit of generating inline models for endpoints that are not selected, I was just thinking on semantics as we are saying "include all models" and it's not actually all of them. But I wasn't able to come up with a better naming. |
I mean, a complete name would be either |
Based on today's discussion, the decision is to build a new switch and offer a wildcard AND specific components. The components would also automatically bring their dependent components.
A component name that doesn't exist should make this WARN. |
Is your feature request related to a problem? Please describe the problem.
I'm automating client generation for my APIs. However, not all models that are shared my services are directly used by endpoints, so Kiota isn't generating the models for them.
Client library/SDK language
Csharp
Describe the solution you'd like
Add a flag on
kiota generate --all-models
to enable generating models for all components in the swagger.json.Additional context
I'm generating my swagger.json using Swashbuckle.Swaggergen and adding in the models that aren't in endpoints using DocumentFilters
The text was updated successfully, but these errors were encountered: