Friday, August 10, 2018

Release 0.2.0 (Alpha): A Little More Swagger

The first major update to the framework, since the alpha launch, has just been announced.  We are pleased to announce the integration of Controller and Schema documentation.  Starting with this release (0.2.0), the Controller and Schema registries will now also house documentation information (e.g. title, description, etc).  Additionally, with the Controllers, we now support enforcement of parameter (path, query) types.

As you can see, the documentation is supported via JSDoc comments, type annotations, and even directly via Decorators (SchemaBody, SchemaQuery, PathParam, Describe...).  This reinforces the paradigm of not forcing developers to repeat themselves.

Additionally, with the documentation model created, we now support the ability to take that model and generate familiar output formats.   The format we are launching with, is Swagger v2.0 (Version 3 will be supported when the swagger-codegen tools supports it).  When the @travetto/swagger module is imported, it will automatically register a /swagger.json endpoint that will return the API specification.

Not to stop short, we additionally provide the ability to generate a client, at run-time, from the swagger spec, using the swagger-codegen tool.  If configured properly, every change to a model or an endpoint will trigger a regeneration of the spec as well as the client.  This should be useful when doing full stack development, and wanting to have a typed model/client between the front end and back end.

In addition to the above there have been minor fixes and performance enhancements.

Enjoy,
- The Travetto Team

No comments:

Post a Comment