We are the developers behind Fusio an open source API management system. We wanted to build an SDK generator for different languages, which builds an SDK based on the available schema. During this we have experienced the limitations of JSON Schema for code generators. Because of this we have started to develop TypeSchema. A JSON format which can be easily transformed into code and also other specification formats.
We envision a future where the code generation ecosystem just works. That means a user gets an TypeAPI document and he is able to use this document to generate high quality code for either client or server implementations.
The complete website is also opensource, you can check out our repository and take a look at the www folder, there is all code related to the website placed. If you want to take a look at the code generator you can check out the generator repository.
You can contact us directly in case you have a question regarding the project, or you can also take a look at our repository.
In our mission to improve code generation we write articles explaining our thoughts and background regarding TypeSchema and the hole API and code generation ecosystem. If you are interested you can take a look at the following articles:
JSON Schema is a constraint system which is designed to validate JSON data. Such a constraint system is not great for code generation, with TypeSchema our focus is to model data to be able to generate high quality code.
For code generators it is difficult to work with JSON Schema since it is designed to validate JSON data. In JSON
Schema you dont need to provide any keywords i.e. {}
is a valid JSON Schema which basically allows every
value and the defined keywords are applied based on the actual data. This means you can interpret a schema only if you
have also the actual data. A code generator on the other hand needs to determine a concrete type of a schema without
the actual data.
JSON Schema has many keywords which contain logic like dependencies
, not
,
if/then/else
which are basically not needed for code generators and really complicates building them. We
have also explained some pitfalls in our
migration document.
TypeSchema does not work with JSON pointer. In TypeSchema you reference every type simply by the name i.e.
Student
. In JSON Schema you need to provide the path i.e. #/definitions/Student
to the
schema. In TypeSchema you can also reference only local types. If you want to import a remote schema you need to
explicit declare it via $import
.