Hacker News new | ask | show | jobs
by kitd 744 days ago
JSONSchema is good for this IME. It can model 99.9% of usual models, supports generation & validation for most major languages. It's also part of OpenAPI, useful if you expand your modelling to REST APIs.

https://json-schema.org/implementations

1 comments

how can i auto generate api code with this
You would use OpenAPI (formerly Swagger) [1] for that, which includes JSONSchema for data types but also adds specs for defining REST apis. There are plenty of generators and other tools that work with OpenAPI [2]

[1] https://www.openapis.org/

[2] https://openapi-generator.tech/