Angular OpenAPI/Swagger Client
A simple and powerful OpenAPI/Swagger Client for Angular, based on promises to connect with endpoint using OpenAPI/Swagger Specification 2.0.
Features
POST
,PUT
,GET
,DELETE
,PATCH
andCONNECT
request are supported.- Params in:
query
,path
,formData
andheader
are supported. SecuritySchema
withsecurity
in API are supported(only typeapiKey
).- By default,
PUT
andPOST
request send withcontent-type: application/x-www-form-urlencoded
. - Removes all parameters that have not been established in the API definition.
- Implements a Pre-Validator for params and supported
data types
,format
andrequired
. - Global static and dynamic default value based on LocalStorage.
- Support for uploading files using consume in the API definition and with at least one parameter in formData.
Getting Started
Install via NPM
npm install angular-swagger2-client
Install via Bower
bower install angular-swagger2-client
- Include the required libraries in your
index.html
:
My Angular Application <!-- Angular swagger Client --> ...
IMPORTANT: Where
vendor
you need replace for you downaload directory. If you ussingbower
replace forbower_components
, and if you usingnpm
you need replace fornode_modules
- Inject
angular-swagger2-client
module
angular
- Prepare you swagger
angular
Requirements
- AngularJS 1.4+
API
object
Params
object
jsonObject required
This param is required and expect a json object of swagger.
IMPORTANT: Only accepts the OpenAPI/Swagger Specification version 2.0.
object
defaultStaticData optional
This parameter only accepts an object with keys and their respective values that will be used by default in all API's.
IMPORTANT: Parameters that have not been defined in the
parameterObject
orsecurityRequirementObject
will not be used.
array
defaultDynamicData optional
This parameter only accepts an array with the list of localStorage keys. These keys are processed at runtime to ensure current values are obtained.
IMPORTANT: Parameters that have not been defined in the
parameterObject
orsecurityRequirementObject
will not be used.
Thanks:
This project is based on the angular-swaggerific repository.