Swagger Client exposes these functionalities for OpenAPI 2.0 and OpenAPI 3:
- Static methods for...
- HTTP Client (
http) - Document Resolver (monolithic & subtree) (
resolve,resolveSubtree) - TryItOut Executor (
buildRequest,execute)
- HTTP Client (
- A constructor with the methods...
- HTTP Client, for convenience (
http) - Document Resolver, which will use
urlorspecfrom the instance (resolve) - TryItOut Executor, bound to the
httpandspecinstance properties (execute) - Tags Interface, also bound to the instance
- HTTP Client, for convenience (
It is also possible to use SwaggerClient without explicitly instantiating the constructor.
import SwaggerClient from 'swagger-client';
new SwaggerClient('http://petstore.swagger.io/v2/swagger.json');
SwaggerClient('http://petstore.swagger.io/v2/swagger.json');
// these two lines are equivalentIf you call the constructor as function, constructor is instantiated for you implicitly.