Skip to content

Releases: onebeyond/swagger-endpoint-validator

v4.1.0

09 Jun 09:21
6ebf949

Choose a tag to compare

What's Changed

New Contributors

Full Changelog: v4.0.0...v4.1.0

v4.0.0

30 Mar 08:08
426e658

Choose a tag to compare

What's Changed

New Contributors

Full Changelog: v3.0.2...v4.0.0

v3.0.2

03 May 10:18

Choose a tag to compare

Full Changelog: v3.0.1...v3.0.2

v3.0.1

07 Mar 13:02
a142d19

Choose a tag to compare

What's Changed

New Contributors

Full Changelog: v2.1.0...v3.0.1

v2.1.0

24 Jul 15:32
9216e1c

Choose a tag to compare

Main changes

This PR adds the possibility to set advanced configuration through the options object when initializing it.

This advanced configuration is related to the underlying validator. More information here (https://www.npmjs.com/package/express-openapi-validator#advanced-usage).

By default the validator will take the default values except for validateResponses, that we force to true if there is no property in the options object to customize it (I did it to avoid breaking down current systems using the validator).

This shouldn't affect to the services using this library, as all the options have a default value.

Other changes

  • Updated depencencies:
    • js-yaml: 3.13.1 → 3.14.0
    • eslint: 6.8.0 → 7.5.0
    • eslint-config-airbnb-base: 14.1.0 → 14.2.0
    • eslint-plugin-import: 2.20.2 → 2.22.0
    • eslint-plugin-jest: 23.9.0 → 23.18.0
    • jest: 26.0.1 → 26.1.0
    • jest-junit: 10.0.0 → 11.0.1

Context

Changelog

v2.0.2

06 May 11:07
bbb20f6

Choose a tag to compare

Main changes

  • Added optional endpoint to show UI with API documentation (apiDocEndpoint in validator config parameters).
  • Added console warning message when using jsdoc format to inform about deprecation of this format.
  • Removed ignorePaths as apiDocEndpoint and validationEndpoint have been declared before initializing the validator, so they are not included in the validation process any more.
  • Added example of allOf to yaml docs.

Other changes

  • Added a function to run a demo server to be able to test the library.
  • Added npm outdated to pre-push hook.
  • Updated depencencies:
    • express-openapi-validator: 3.10.0 => 3.12.7
    • openapi-enforcer: 1.10.1 => 1.10.3
    • swagger2openapi: 6.0.2 => 6.0.3
    • eslint-plugin-jest: 23.8.2 => 23.9.0
    • husky: 4.2.3 => 4.2.5
    • jest: 25.2.4 => 26.0.1

Context

Changelog

v2.0.1

13 Apr 13:21
fc6802a

Choose a tag to compare

Main changes

  • If the validator is initialized with an validationEndpoint, this endpoint is skipped from the validator itself to be able to do requests to it without validation errors.
  • Improved validateSchema method.
  • Renamed input to request in validation endpoint requestBody to have a more accurate name.

Other changes

  • Force validator to fully validate formats.
  • Simplified some debug messages.
  • Removed obsolete documentation from README to avoid confusion.
  • Fixed status code sent by the validator for some errors.

v2.0.0

06 Apr 07:46
7924ef2

Choose a tag to compare

⚠️ IMPORTANT! ⚠️

This is a new major version that is NOT compatible with the previous one. The validator is used in a totally different way. So be careful when updating your package.

Main changes

  • Changed how the validator is used: now you only need to initialize the validator (init(app, options)) after creating the Express application and it will AUTOMATICALLY validate all the requests and responses (depending on the configuration options when initializing). No need to call the validate method explicitly (before validateAPIInput() and validateAPIOutput() had to be called).

  • Added normalizeOptions module to normalize options input parameter and to set default values if any parameter is not set by the user.

  • Added openAPISpecification module to generate the OpenAPI specification based on the format of the documentation used by the user to document the endpoints of the API. Supported formats are:

    • yaml if the documentation is stored in a yaml file (see js-yaml).
    • yaml_jsdoc if the documentation is generated using yaml format in inline JSDoc documents tagged with @swagger (see swagger-jsdoc).
    • jsdoc if the documentation is generated using pure JSDoc format (see express-swagger-generator).
  • Added customErrorHandler that catches requests validation errors and sends a custom error.

  • Added validationEndpoint module to add an optional endpoint to be able to do explicit requests and responses validation (e.g. for e2e tests of the API).

  • Removed dependency from swagger-model-validator.

Minor changes

  • huskyrc has been removed. Now it's inside package.json.
  • Improved methods documentation.
  • Added debug information (prefix: swagger-endpoint-validator).
  • Added lib/constants.js file to store constants used across the library.

3rd party libraries used

  • express-openapi-validator: this is the core library used to automatically validate API requests and responses using an OpenAPI 3 specification.
  • swagger2openapi: used to convert from OpenAPI 2.0 to OpenAPI 3.0.x
  • js-yaml: parses string as single YAML document and returns a JavaScript object. Used when the user uses a yaml format to write the API documentation.
  • express-swagger-generator: allows to integrate OpenAPI using JSDoc comments and generates the OpenAPI specification (v2 format). Used when the user uses a yaml_jsdoc format file to write the API documentation.
  • swagger-jsdoc: allows to integrate Swagger using JSDoc comments in the code by just adding @swagger on top of the DocBlock and generates the OpenAPI specification (v3 format). Used when the user uses a jsdoc format to write the API documentation.
  • openapi-enforcer: this library is used to be able to do independent validation of values against OAS schemas.
  • supertest: this is used in development to do e2e testing of the API.

Work in progress

There is still some work to be done. We are releasing the first version of this new validator so we can start using it. But these issues will be added to the backlog to work on them:

  • Update documentation (README).
  • Add unitary tests.
  • Add optional endpoint validation tests.
  • Support for allOf and other tags added in the OpenAPI v3 spec.
  • Optional publication of the generated API doc (swagger-ui-express)
  • Investigate validator-badge
  • Add issue in express-swagger-generator because it doesn't type: object to the schemas and we have to do it manually.

v1.1.5

24 Mar 11:11
e3e9626

Choose a tag to compare

Notable changes

 swagger-jsdoc               ^3.5.0  →   ^4.0.0
 swagger-ui-express          ^4.1.3  →   ^4.1.4
 eslint-config-airbnb-base  ^14.0.0  →  ^14.1.0
 eslint-plugin-import       ^2.20.0  →  ^2.20.1
 eslint-plugin-jest         ^23.6.0  →  ^23.8.2
 husky                       ^4.2.1  →   ^4.2.3

NPM Publication details

npm notice 
npm notice 📦  swagger-endpoint-validator@1.1.5
npm notice === Tarball Contents === 
npm notice 101B  .huskyrc                      
npm notice 0     docs/.nojekyll                
npm notice 968B  docs/index.html               
npm notice 1.1kB test/jsdoc/e2e.invalid.test.js
npm notice 1.7kB test/yaml/e2e.invalid.test.js 
npm notice 1.0kB test/jsdoc/e2e.valid.test.js  
npm notice 1.0kB test/yaml/e2e.valid.test.js   
npm notice 358B  lib/errors.js                 
npm notice 2.5kB test/jsdoc/fake-server.js     
npm notice 3.6kB test/yaml/fake-server.js      
npm notice 4.6kB index.js                      
npm notice 164B  test/jsdoc/models.js          
npm notice 385B  test/yaml/models.js           
npm notice 570B  test/jsdoc/unit.test.js       
npm notice 1.2kB test/yaml/unit.test.js        
npm notice 780B  .eslintrc.json                
npm notice 1.2kB package.json                  
npm notice 8.0kB docs/README.md                
npm notice 7.8kB README.md                     
npm notice 293B  .travis.yml                   
npm notice === Tarball Details === 
npm notice name:          swagger-endpoint-validator              
npm notice version:       1.1.5                                   
npm notice package size:  6.4 kB                                  
npm notice unpacked size: 37.3 kB                                 
npm notice shasum:        f0c3b17851c2f61db6e7fd2a1eaf1f482e1ffb94
npm notice integrity:     sha512-k2nkbFByuytBg[...]gPiAX0ycWNTCQ==
npm notice total files:   20                                      
npm notice 
+ swagger-endpoint-validator@1.1.5

v1.1.4

23 Mar 11:43
550a802

Choose a tag to compare

NPM logs from CI

npm notice 
npm notice 📦  swagger-endpoint-validator@1.1.4
npm notice === Tarball Contents === 
npm notice 101B  .huskyrc                      
npm notice 0     docs/.nojekyll                
npm notice 968B  docs/index.html               
npm notice 1.1kB test/jsdoc/e2e.invalid.test.js
npm notice 1.7kB test/yaml/e2e.invalid.test.js 
npm notice 1.0kB test/jsdoc/e2e.valid.test.js  
npm notice 1.0kB test/yaml/e2e.valid.test.js   
npm notice 358B  lib/errors.js                 
npm notice 2.5kB test/jsdoc/fake-server.js     
npm notice 3.6kB test/yaml/fake-server.js      
npm notice 4.6kB index.js                      
npm notice 164B  test/jsdoc/models.js          
npm notice 385B  test/yaml/models.js           
npm notice 570B  test/jsdoc/unit.test.js       
npm notice 1.2kB test/yaml/unit.test.js        
npm notice 780B  .eslintrc.json                
npm notice 1.2kB package.json                  
npm notice 8.0kB docs/README.md                
npm notice 8.0kB README.md                     
npm notice 293B  .travis.yml                   
npm notice 1.6kB .circleci/config.yml          
npm notice === Tarball Details === 
npm notice name:          swagger-endpoint-validator              
npm notice version:       1.1.4                                   
npm notice package size:  6.9 kB                                  
npm notice unpacked size: 39.1 kB                                 
npm notice shasum:        bae6d750c3f9514a1714c441844ad7cb5e80312c
npm notice integrity:     sha512-e+5z/EAUDlwq0[...]LRM71e/g83TYw==
npm notice total files:   21                                      
npm notice