openapi-library / OpenAPIValidators

Use Jest or Chai to assert that HTTP responses satisfy an OpenAPI spec
MIT License
189 stars 35 forks source link

Support server variables in Chai plugin #218

Closed rwalle61 closed 3 years ago

rwalle61 commented 3 years ago

Completes https://github.com/openapi-library/OpenAPIValidators/issues/89 for Chai

codecov[bot] commented 3 years ago

Codecov Report

Merging #218 (7e4615e) into master (976dec2) will not change coverage. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master      #218   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           33        34    +1     
  Lines          670       693   +23     
  Branches        49        49           
=========================================
+ Hits           670       693   +23     
Impacted Files Coverage Δ
...enapi-validator/lib/classes/AbstractOpenApiSpec.js 100.00% <100.00%> (ø)
.../openapi-validator/lib/classes/AbstractResponse.js 100.00% <100.00%> (ø)
.../lib/openapi-validator/lib/classes/OpenApi2Spec.js 100.00% <100.00%> (ø)
.../lib/openapi-validator/lib/classes/OpenApi3Spec.js 100.00% <100.00%> (ø)
...penapi-validator/lib/classes/SuperAgentResponse.js 100.00% <100.00%> (ø)
...or/lib/openapi-validator/lib/openApiSpecFactory.js 100.00% <100.00%> (ø)
.../openapi-validator/lib/utils/OpenApi3Spec.utils.js 100.00% <100.00%> (ø)
...or/lib/openapi-validator/lib/utils/common.utils.js 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 976dec2...7e4615e. Read the comment docs.

rwalle61 commented 3 years ago

The tests cover the use cases I can think of, having looked at the documentation. If any are missing, please let me know.

The code is more complicated than I'd like, but handling OpenAPI 3 server variables just seems to be pretty complex. Very happy to suggestions to improve this if there are any

rwalle61 commented 3 years ago

After merging, this still need to be ported to Jest, then released