@@ -19,7 +19,7 @@ as well as tools to validate data against their schema.
1919This package follows Swagger 2.0. specification (aka OpenAPI 2.0). Reference
2020can be found here: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md.
2121
22- Validating a specification
22+ # Validating a specification
2323
2424Validates a spec document (from JSON or YAML) against the JSON schema for swagger,
2525then checks a number of extra rules that can't be expressed in JSON schema.
@@ -30,34 +30,36 @@ Entry points:
3030 - SpecValidator.Validate()
3131
3232Reported as errors:
33- [x] definition can't declare a property that's already defined by one of its ancestors
34- [x] definition's ancestor can't be a descendant of the same model
35- [x] path uniqueness: each api path should be non-verbatim (account for path param names) unique per method
36- [x] each security reference should contain only unique scopes
37- [x] each security scope in a security definition should be unique
38- [x] parameters in path must be unique
39- [x] each path parameter must correspond to a parameter placeholder and vice versa
40- [x] each referenceable definition must have references
41- [x] each definition property listed in the required array must be defined in the properties of the model
42- [x] each parameter should have a unique `name` and `type` combination
43- [x] each operation should have only 1 parameter of type body
44- [x] each reference must point to a valid object
45- [x] every default value that is specified must validate against the schema for that property
46- [x] items property is required for all schemas/definitions of type `array`
47- [x] path parameters must be declared a required
48- [x] headers must not contain $ref
49- [x] schema and property examples provided must validate against their respective object's schema
50- [x] examples provided must validate their schema
33+
34+ [x] definition can't declare a property that's already defined by one of its ancestors
35+ [x] definition's ancestor can't be a descendant of the same model
36+ [x] path uniqueness: each api path should be non-verbatim (account for path param names) unique per method
37+ [x] each security reference should contain only unique scopes
38+ [x] each security scope in a security definition should be unique
39+ [x] parameters in path must be unique
40+ [x] each path parameter must correspond to a parameter placeholder and vice versa
41+ [x] each referenceable definition must have references
42+ [x] each definition property listed in the required array must be defined in the properties of the model
43+ [x] each parameter should have a unique `name` and `type` combination
44+ [x] each operation should have only 1 parameter of type body
45+ [x] each reference must point to a valid object
46+ [x] every default value that is specified must validate against the schema for that property
47+ [x] items property is required for all schemas/definitions of type `array`
48+ [x] path parameters must be declared a required
49+ [x] headers must not contain $ref
50+ [x] schema and property examples provided must validate against their respective object's schema
51+ [x] examples provided must validate their schema
5152
5253Reported as warnings:
53- [x] path parameters should not contain any of [{,},\w]
54- [x] empty path
55- [x] unused definitions
56- [x] unsupported validation of examples on non-JSON media types
57- [x] examples in response without schema
58- [x] readOnly properties should not be required
5954
60- Validating a schema
55+ [x] path parameters should not contain any of [{,},\w]
56+ [x] empty path
57+ [x] unused definitions
58+ [x] unsupported validation of examples on non-JSON media types
59+ [x] examples in response without schema
60+ [x] readOnly properties should not be required
61+
62+ # Validating a schema
6163
6264The schema validation toolkit validates data against JSON-schema-draft 04 schema.
6365
@@ -70,16 +72,16 @@ Entry points:
7072 - AgainstSchema()
7173 - ...
7274
73- Known limitations
75+ # Known limitations
7476
7577With the current version of this package, the following aspects of swagger are not yet supported:
76- [ ] errors and warnings are not reported with key/line number in spec
77- [ ] default values and examples on responses only support application/json producer type
78- [ ] invalid numeric constraints (such as Minimum, etc..) are not checked except for default and example values
79- [ ] rules for collectionFormat are not implemented
80- [ ] no validation rule for polymorphism support (discriminator) [not done here]
81- [ ] valid js ECMA regexp not supported by Go regexp engine are considered invalid
82- [ ] arbitrary large numbers are not supported: max is math.MaxFloat64
8378
79+ [ ] errors and warnings are not reported with key/line number in spec
80+ [ ] default values and examples on responses only support application/json producer type
81+ [ ] invalid numeric constraints (such as Minimum, etc..) are not checked except for default and example values
82+ [ ] rules for collectionFormat are not implemented
83+ [ ] no validation rule for polymorphism support (discriminator) [not done here]
84+ [ ] valid js ECMA regexp not supported by Go regexp engine are considered invalid
85+ [ ] arbitrary large numbers are not supported: max is math.MaxFloat64
8486*/
8587package validate
0 commit comments