Skip to content

Commit af96354

Browse files
committed
1 parent a35b54b commit af96354

4 files changed

Lines changed: 28 additions & 22 deletions

File tree

json-schema-for-3.1.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ dependentSchemas - map of schemas - somewhat complex, is it related to dependent
8383

8484
prefixItems: array of schema - done
8585
items: array of schema - in 3.0
86-
contains: schema
86+
contains: schema - done
8787

8888
properties: object, each value json schema - in 3.0
8989
patternProperties: object each value JSON schema

lib/openapi3_parser/node/schema/v3_1.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,11 @@ def else
7474
def prefix_items
7575
self["prefixItems"]
7676
end
77+
78+
# @return [Schema, nil]
79+
def contains
80+
self["contains"]
81+
end
7782
end
7883
end
7984
end

lib/openapi3_parser/node_factory/schema/v3_1.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ class V3_1 < NodeFactory::Object # rubocop:disable Naming/ClassAndModuleCamelCas
3333
field "then", factory: :referenceable_schema
3434
field "else", factory: :referenceable_schema
3535
field "prefixItems", factory: :prefix_items_factory
36+
field "contains", factory: :referenceable_schema
3637

3738
def build_node(data, node_context)
3839
Node::Schema::V3_1.new(data, node_context)

spec/support/examples/v3.1/changes.yaml

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -86,27 +86,27 @@ components:
8686
# exclusiveMaximum: 111
8787
# minimum: 10
8888
# exclusiveMinimum: 9
89-
# String:
90-
# type: string
91-
# maxLength: 10
92-
# minLength: 5
93-
# pattern: "[a-z]*"
94-
# Array:
95-
# type: array
96-
# maxItems: 10
97-
# minItems: 1
98-
# uniqueItems: true
99-
# contains:
100-
# const: "test"
101-
# minContains: 1
102-
# maxContains: 1
103-
# prefixItems:
104-
# - const: "item"
105-
# type: string
106-
# items:
107-
# type: string
108-
# unevaluatedItems:
109-
# type: string
89+
String:
90+
type: string
91+
maxLength: 10
92+
minLength: 5
93+
pattern: "[a-z]*"
94+
Array:
95+
type: array
96+
maxItems: 10
97+
minItems: 1
98+
uniqueItems: true
99+
contains:
100+
const: "test"
101+
minContains: 1
102+
maxContains: 1
103+
prefixItems:
104+
- const: "item"
105+
type: string
106+
items:
107+
type: string
108+
unevaluatedItems:
109+
type: string
110110
# Add object
111111
# Add content types
112112
# Add $ref usage (plain, merged, defs)

0 commit comments

Comments
 (0)