@stoplight/spectral
Advanced tools
Comparing version 1.1.2 to 1.2.0
@@ -6,4 +6,5 @@ export declare const functions: { | ||
schema: any; | ||
schemaPath: any; | ||
truthy: any; | ||
xor: any; | ||
}; |
@@ -8,2 +8,3 @@ "use strict"; | ||
schema: require('./schema').schema, | ||
schemaPath: require('./schema-path').schemaPath, | ||
truthy: require('./truthy').truthy, | ||
@@ -10,0 +11,0 @@ xor: require('./xor').xor, |
{ | ||
"name": "@stoplight/spectral", | ||
"version": "1.1.2", | ||
"version": "1.2.0", | ||
"description": "A flexible object linter with out of the box support for OpenAPI v2 and v3.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -34,3 +34,3 @@ ![Spectral logo](img/spectral-banner.png) | ||
### Creating a custom rule: | ||
### Creating a custom rule | ||
@@ -151,3 +151,3 @@ Spectral has a built-in set of functions which you can reference in your rules. This example uses the `RuleFunction.PATTERN` to create a rule that checks that all property values are in snake case. | ||
### Linting an OAS 2 document: | ||
### Linting an OAS 2 document | ||
@@ -154,0 +154,0 @@ Spectral also includes a number of ready made rules and functions for OpenAPI Specification (OAS) 2 and 3 documents. This example uses the OAS 2 rules to lint a document. |
@@ -89,3 +89,2 @@ "use strict"; | ||
'operation-security-defined': { | ||
enabled: true, | ||
summary: 'Operation `security` values must match a scheme defined in the `securityDefinitions` object.', | ||
@@ -102,4 +101,16 @@ type: types_1.RuleType.VALIDATION, | ||
}, | ||
'valid-example': { | ||
summary: 'Examples must be valid against their defined schema.', | ||
type: types_1.RuleType.VALIDATION, | ||
given: '$..[?(@.example)]', | ||
then: { | ||
function: types_1.RuleFunction.SCHEMAPATH, | ||
functionOptions: { | ||
field: 'example', | ||
schemaPath: '$', | ||
}, | ||
}, | ||
}, | ||
}); | ||
}; | ||
//# sourceMappingURL=index.js.map |
@@ -54,3 +54,2 @@ "use strict"; | ||
'operation-security-defined': { | ||
enabled: true, | ||
summary: 'Operation `security` values must match a scheme defined in the `components.securitySchemes` object.', | ||
@@ -92,4 +91,16 @@ type: types_1.RuleType.VALIDATION, | ||
}, | ||
'valid-example': { | ||
summary: 'Examples must be valid against their defined schema.', | ||
type: types_1.RuleType.VALIDATION, | ||
given: '$..[?(@.example)]', | ||
then: { | ||
function: types_1.RuleFunction.SCHEMAPATH, | ||
functionOptions: { | ||
field: 'example', | ||
schemaPath: '$', | ||
}, | ||
}, | ||
}, | ||
}); | ||
}; | ||
//# sourceMappingURL=index.js.map |
@@ -10,4 +10,5 @@ export declare enum RuleType { | ||
SCHEMA = "schema", | ||
SCHEMAPATH = "schemaPath", | ||
TRUTHY = "truthy", | ||
XOR = "xor" | ||
} |
@@ -14,2 +14,3 @@ "use strict"; | ||
RuleFunction["SCHEMA"] = "schema"; | ||
RuleFunction["SCHEMAPATH"] = "schemaPath"; | ||
RuleFunction["TRUTHY"] = "truthy"; | ||
@@ -16,0 +17,0 @@ RuleFunction["XOR"] = "xor"; |
@@ -47,1 +47,6 @@ import { ValidationSeverity, ValidationSeverityLabel } from '@stoplight/types/validations'; | ||
export declare type SchemaRule = IRule<RuleFunction.SCHEMA, ISchemaOptions>; | ||
export interface ISchemaPathOptions { | ||
schemaPath: string; | ||
field?: string; | ||
} | ||
export declare type SchemaPathRule = IRule<RuleFunction.SCHEMAPATH, ISchemaPathOptions>; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
232259
86
5149