-
-
Notifications
You must be signed in to change notification settings - Fork 67
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]: JsonSchema.Net.Generation for openapi schema generation? #748
Comments
Hey @SGStino That's a good idea! As long as there are possibilities to add the special "x-kubernetes" attributes, we should be good to go. According to the docs of Kubernetes, they use openapi v3 and as such, we could use a lib for that. |
The library supports adding custom vocabulary, so the x-kubernetes should be implemented as those. I'll see if I can bash something together as reference so you can see how to fit it in the operator? |
That would be amazing! Thank you :-) |
https://github.com/SGStino/JsonSchemaTest If you have any real-life examples of entities we can test against? |
Hey @SGStino Sadly - no. Since I made this SDK, I've only written one operator (weird, I know). But maybe other contributors can provide some real world examples. |
New stuff that might change the approach: Maps .NET types to JSON schema objects using contract metadata from JsonTypeInfo instances. https://learn.microsoft.com/en-us/dotnet/api/system.text.json.schema.jsonschemaexporter?view=net-9.0 |
That might explain the demise of swashbuckle in dotnet 9. Depending on how extendable the generator is in it's early days it could be easier to use json-everything. |
The JSON Schema Exporter stuff is consumed by https://github.com/microsoft/OpenAPI.NET and https://www.nuget.org/packages/Microsoft.AspNetCore.OpenApi to do the full picture. My belief so far is there are ample extension points to do the whole stack. For instance, ASP.NET allows schema modification by various attributes and stuff. And schema document transformation, etc. So you can pretty much make it look how you want. The ASP.NET Core version of the usage build schema off of the API Explorer API, which exports Action/Type information, etc. Basically tying a few different libraries together. |
Is your feature request related to a problem? Please describe.
Currently, the schema generation is limited to what is implemented,
Issues like #741, #396, #351 could possibly benefit from this
Describe the solution you would like
It would be nice to team up with a schema generator library and outsource those capabilities to generate the OpenApiV3 spec.
JsonSchema.Net offers JsonSchema with customizable keywords and validation on JsonNodes.
JsonSchema.Net.Generation can generate schemas from C# classes with reflection (for use in KubeOps.Cli?)
Additional Context
No response
The text was updated successfully, but these errors were encountered: