Swagger-js 2.1.1 has been released!
The first formal release of Swagger 2.0 support in the javascript library. This project is used extensively by swagger-ui for communicating with swagger-enabled servers. There are many changes between this release and previous 2.0.x versions.
Swagger-js and other formal swagger projects have had intermediate, milestone releases supporting the swagger 2.0 specification. This version supersedes the previous milestones in accordance with the semver strategy.
Usage notes
Swagger-js introduces a new constructor. Instead of passing all arguments in the constructor of swagger-client, the preferred mechanism for instantiation is as follows:
var client = new SwaggerClient();
client.initialize(url, options);
The existing constructor is still supported.
Major changes
There is now a general resolver class which is responsible for finding remote references to other objects and bringing them into a single, canonical swagger instance. This step also allows for resolving allOf and other modeling features.
You can now pass in a javascript object representing a swagger description. This means remote calls are not necessary when initializing the client to read the spec (#408).
Swagger HTTP is now pluggable. That means you can create your own transports to replace the existing superagent or jquery based HTTP clients (#239).
YAML is now a first-class format in both core and remote, shared references #323
Notable features
- allOf composition and inheritence support added to top-level
/definitions(note, recursiveallOfsupport is not implemented, nor isallOfenabled for inline models) #455, #188 - Remote references for models, model properties, parameters, operations now supported, #433, #460, #417
- Response interceptors can now post-process responses from API calls, #126
- Support for array collection formats #191
- Support for referenced path parameters, #360
- Response headers are now exposed in response models #293
- Better handling of data types, #341, #353, #339, #343
- Better display of model description, #294
- Posting empty body with
application/jsonwill now send empty object{}#326 - Better handling of missing parameters, #375
Notable bug fixes
- No more global swagger-client instance #350
- basePath issue for v1.x specs fixed #346
- enabled default callbacks #308
- enabled macro support for operations, models #307
- Authorizations now follow the spec, #283
- Enum enhancements, fixes #391
- Global consumes, produces now supported #367
- Use of reserved words no longer cause a failure to build client #405
- Read-only attriubutes in model are no longer shown as
optional#297 - Better translation of
enumfrom 1.x specs #376 - Https in basepath supported #398
Limitations
Find any? Please send bug reports and pull-requests to the develop_2.0 branch!