A swisspush project
Write your type definitions in TypeScript and Typson will generate json-schemas.
See it in action with its buddy docson
npm install typson -gtypson schema example/invoice/line.tstypson schema example/invoice/line.ts Invoice<script src="vendor/require.js"/>
<script>
require(["lib/typson-schema"], function(typson) {
typson.schema("example/invoice/line.ts", "Invoice").done(function(schema) {
console.log(schema);
});
});
</script>
Generated definitions are compatible with Swagger, you can copy Typson's output to your API files.
You can make Swagger UI read type definitions directly by integrating Typson, you will need a modified version of swagger.js. This version just adds the capability to load the models from another source.
See how it looks like in the Swagger Typson example (Note: this example also illustrate Docson integration in Swagger).
Then, adapt Swagger UI's index.html to
<script src="/typson/vendor/require.js"></script>
<script>
requirejs.config({
baseUrl: "/typson"
});
requirejs(["lib/typson-swagger"]);
</script>
var typsonReady = $.Deferred();
typsonReady.done(function () {
instead of jQuery's $(function() { initializer.
Then, just replace the models section of your API file with a tsModels property containing the URL pointing to the type script defining the models.
JavaScript
87.4%
HTML
7.2%
TypeScript
5.3%
A swisspush project
Write your type definitions in TypeScript and Typson will generate json-schemas.
See it in action with its buddy docson
npm install typson -gtypson schema example/invoice/line.tstypson schema example/invoice/line.ts Invoice<script src="vendor/require.js"/>
<script>
require(["lib/typson-schema"], function(typson) {
typson.schema("example/invoice/line.ts", "Invoice").done(function(schema) {
console.log(schema);
});
});
</script>
Generated definitions are compatible with Swagger, you can copy Typson's output to your API files.
You can make Swagger UI read type definitions directly by integrating Typson, you will need a modified version of swagger.js. This version just adds the capability to load the models from another source.
See how it looks like in the Swagger Typson example (Note: this example also illustrate Docson integration in Swagger).
Then, adapt Swagger UI's index.html to
<script src="/typson/vendor/require.js"></script>
<script>
requirejs.config({
baseUrl: "/typson"
});
requirejs(["lib/typson-swagger"]);
</script>
var typsonReady = $.Deferred();
typsonReady.done(function () {
instead of jQuery's $(function() { initializer.
Then, just replace the models section of your API file with a tsModels property containing the URL pointing to the type script defining the models.
JavaScript
87.4%
HTML
7.2%
TypeScript
5.3%