@ibm-cloud/openapi-ruleset-utilities
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -0,1 +1,8 @@ | ||
## @ibm-cloud/openapi-ruleset-utilities [1.0.2](https://github.com/IBM/openapi-validator/compare/@ibm-cloud/openapi-ruleset-utilities@1.0.1...@ibm-cloud/openapi-ruleset-utilities@1.0.2) (2023-05-11) | ||
### Bug Fixes | ||
* **collections:** use correct http method names in collections ([#589](https://github.com/IBM/openapi-validator/issues/589)) ([9a63ca9](https://github.com/IBM/openapi-validator/commit/9a63ca90bc128bdac78c9810831c1d6edc00a774)) | ||
## @ibm-cloud/openapi-ruleset-utilities [1.0.1](https://github.com/IBM/openapi-validator/compare/@ibm-cloud/openapi-ruleset-utilities@1.0.0...@ibm-cloud/openapi-ruleset-utilities@1.0.1) (2023-05-01) | ||
@@ -2,0 +9,0 @@ |
{ | ||
"name": "@ibm-cloud/openapi-ruleset-utilities", | ||
"description": "Programmatic utility functions for creating Spectral-formatted OpenAPI Rulesets", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"license": "Apache-2.0", | ||
@@ -6,0 +6,0 @@ "private": false, |
@@ -9,4 +9,7 @@ /** | ||
// A collection of all locations where an operation might exist. | ||
const operations = [`$.paths[*][get,put,post,delete,options,head,patch,trace]`]; | ||
// A collection of locations of top-level response schemas | ||
const responseSchemas = ['$.paths[*][*][responses][*].content[*].schema']; | ||
const responseSchemas = [`${operations[0]}[responses][*].content[*].schema`]; | ||
@@ -18,8 +21,8 @@ // A collection of locations where a JSON Schema object can be *used*. | ||
const schemas = [ | ||
'$.paths[*][parameters][*].schema', | ||
'$.paths[*][parameters][*].content[*].schema', | ||
'$.paths[*][*][parameters][*].schema', | ||
'$.paths[*][*][parameters,responses][*].content[*].schema', | ||
'$.paths[*][*].responses[*].headers[*].schema', | ||
'$.paths[*][*][requestBody].content[*].schema', | ||
`$.paths[*][parameters][*].schema`, | ||
`$.paths[*][parameters][*].content[*].schema`, | ||
`${operations[0]}[parameters][*].schema`, | ||
`${operations[0]}[parameters,responses][*].content[*].schema`, | ||
`${operations[0]}.responses[*].headers[*].schema`, | ||
`${operations[0]}[requestBody].content[*].schema`, | ||
]; | ||
@@ -31,17 +34,15 @@ | ||
const parameters = [ | ||
'$.paths[*].parameters[*]', | ||
'$.paths[*][get,put,post,delete,options,head,patch,trace].parameters[*]', | ||
`$.paths[*].parameters[*]`, | ||
`${operations[0]}.parameters[*]`, | ||
]; | ||
const paths = ['$.paths[*]']; | ||
const paths = [`$.paths[*]`]; | ||
const operations = ['$.paths[*][get,put,post,delete,options,head,patch,trace]']; | ||
const patchOperations = [`$.paths[*][patch]`]; | ||
const patchOperations = ['$.paths[*][patch]']; | ||
// A collection of locations where a response schema could be defined | ||
// within an unresolved API definition. | ||
const unresolvedResponseSchemas = [ | ||
'$.paths[*][*].responses[*].content[*].schema', | ||
'$.components.responses[*].content[*].schema', | ||
`${operations[0]}.responses[*].content[*].schema`, | ||
`$.components.responses[*].content[*].schema`, | ||
]; | ||
@@ -52,4 +53,4 @@ | ||
const unresolvedRequestBodySchemas = [ | ||
'$.paths[*][*].requestBody.content[*].schema', | ||
'$.components.requestBodies[*].content[*].schema', | ||
`${operations[0]}.requestBody.content[*].schema`, | ||
`$.components.requestBodies[*].content[*].schema`, | ||
]; | ||
@@ -61,3 +62,3 @@ | ||
// Named schemas. | ||
'$.components.schemas[*]', | ||
`$.components.schemas[*]`, | ||
@@ -69,31 +70,31 @@ // Request/response schemas. | ||
// Parameter schemas. | ||
'$.paths[*].parameters[*].schema', | ||
'$.paths[*].parameters[*].content[*].schema', | ||
'$.paths[*][*].parameters[*].schema', | ||
'$.paths[*][*].parameters[*].content[*].schema', | ||
'$.components.parameters[*].schema', | ||
'$.components.parameters[*].content[*].schema', | ||
`$.paths[*].parameters[*].schema`, | ||
`$.paths[*].parameters[*].content[*].schema`, | ||
`${operations[0]}.parameters[*].schema`, | ||
`${operations[0]}.parameters[*].content[*].schema`, | ||
`$.components.parameters[*].schema`, | ||
`$.components.parameters[*].content[*].schema`, | ||
// Header schemas. | ||
'$.paths[*][*].responses[*].headers[*].schema', | ||
'$.paths[*][*].responses[*].headers[*].content[*].schema', | ||
'$.components.headers[*].schema', | ||
'$.components.headers[*].content[*].schema', | ||
'$.components.responses[*].headers[*].schema', | ||
'$.components.responses[*].headers[*].content[*].schema', | ||
`${operations[0]}.responses[*].headers[*].schema`, | ||
`${operations[0]}.responses[*].headers[*].content[*].schema`, | ||
`$.components.headers[*].schema`, | ||
`$.components.headers[*].content[*].schema`, | ||
`$.components.responses[*].headers[*].schema`, | ||
`$.components.responses[*].headers[*].content[*].schema`, | ||
]; | ||
const securitySchemes = ['$.components.securitySchemes[*]']; | ||
const securitySchemes = [`$.components.securitySchemes[*]`]; | ||
module.exports = { | ||
responseSchemas, | ||
operations, | ||
parameters, | ||
patchOperations, | ||
parameters, | ||
paths, | ||
responseSchemas, | ||
schemas, | ||
securitySchemes, | ||
unresolvedRequestBodySchemas, | ||
unresolvedResponseSchemas, | ||
unresolvedSchemas, | ||
schemas, | ||
securitySchemes, | ||
}; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
105388
3073