-
Notifications
You must be signed in to change notification settings - Fork 620
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 JSON schema from serializable type #1115
Comments
Schema builders are neither the goal for 1.0 neither for particular future release. However, we provide (experimental) functionality for introspecting serializable classes that can be used to build the schema. Using this data, a json schema can be easily built. Introspection mechanism is available via |
FYI, there is https://github.com/Ricky12Awesome/json-schema-serialization which might become handy. |
See the PR I just created for Spring Doc Open API: springdoc/springdoc-openapi#1514 This will integrate with a Spring server using swagger for generation of an Open API schema. |
I've written a library that will generate TypeScript from Kotlinx Serialization classes. https://github.com/adamko-dev/kotlinx-serialization-typescript-generator I think the generated TypeScript could be used to generate a JsonSchema using another library https://github.com/YousefED/typescript-json-schema https://github.com/vega/ts-json-schema-generator |
What is your use-case and why do you need this feature?
I'd like a way to generate a JSON schema from a (serializable) type. It would likely share an implementation with #34 and more general serializer traversal.
The biggest use case, imo, is for documentation, in particular of api endpoints that receive JSON data, especially for something like OpenAPI/Swagger. There's also tools out there (like json-schema-to-typescript that take JSON schema as input to generate data classes for other languages.
Describe the solution you'd like
Ideally, I'd like some kind of generic serializer traversal in
serialization
with format specific uses like this or #34 in their respective format artifacts,The text was updated successfully, but these errors were encountered: