Skip to content

Commit b683c3a

Browse files
committed
Update fields we're tracking for Schema in 3.1
1 parent a701e3d commit b683c3a

File tree

1 file changed

+45
-36
lines changed

1 file changed

+45
-36
lines changed

json-schema-for-3.1.md

Lines changed: 45 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Dealing with the new JSON Schema approach for OpenAPI 3.1.
2828

2929
There is some meta fields:
3030

31-
$ref
31+
$ref - in 3.0
3232
$dynamicRef
3333
$defs
3434
$schema
@@ -39,52 +39,52 @@ $dynamicAnchor
3939

4040
Then a ton of fields:
4141

42-
type: string
43-
enum: array
44-
const: any type
45-
multipleOf: number
46-
maximum: number
47-
exclusiveMaximum: number
48-
minimum: number
49-
exclusiveMinimum: number
50-
maxLength: integer >= 0
51-
minLength: integer >= 0
52-
pattern: string
53-
maxItems: integer >= 0
54-
minItems: integer >= 0
55-
uniqueItems: boolean
56-
maxContains: integer >= 0
57-
minContains: integer >= 0
58-
maxProperties: integer >= 0
59-
minProperties: integer >= 0
42+
type: string - in 3.0
43+
enum: array - in 3.0
44+
const: any type - done
45+
multipleOf: number - in 3.0
46+
maximum: number - in 3.0
47+
exclusiveMaximum: number - in 3.0
48+
minimum: number - in 3.0
49+
exclusiveMinimum: number - in 3.0
50+
maxLength: integer >= 0 - in 3.0
51+
minLength: integer >= 0 - in 3.0
52+
pattern: string - in 3.0
53+
maxItems: integer >= 0 - in 3.0
54+
minItems: integer >= 0 - in 3.0
55+
uniqueItems: boolean - in 3.0
56+
maxContains: integer >= 0 - done
57+
minContains: integer >= 0 - done
58+
maxProperties: integer >= 0 - in 3.0
59+
minProperties: integer >= 0 - in 3.0
6060
required: array, strings, unique
61-
dependentRequired: something complex
61+
dependentRequired: something complex
6262
contentEncoding: string
6363
contentMediaType: string / media type
6464
contentSchema: schema
65-
title: string
66-
description: string
67-
default: any
68-
deprecated: boolean (default false)
69-
readOnly: boolean (default false)
70-
writeOnly: boolean (default false)
71-
examples: array
72-
73-
74-
allOf - non empty array of schemas
75-
anyOf - non empty array of schemas
76-
oneOf - non empty array of schemas
77-
not - schema
65+
title: string - in 3.0
66+
description: string - in 3.0
67+
default: any - in 3.0
68+
deprecated: boolean (default false) - in 3.0
69+
readOnly: boolean (default false) - in 3.0
70+
writeOnly: boolean (default false) - in 3.0
71+
examples: array - done
72+
format: any - in 3.0
73+
74+
allOf - non empty array of schemas - in 3.0
75+
anyOf - non empty array of schemas - in 3.0
76+
oneOf - non empty array of schemas - in 3.0
77+
not - schema - in 3.0
7878

7979
if - single schema
8080
then - single schema
8181
else - single schema
8282

8383
prefixItems: schema
84-
items: schema
84+
items: schema - in 3.0
8585
contains: schema
8686

87-
properties: object, each value json schema
87+
properties: object, each value json schema - in 3.0
8888
patternProperties: object each value JSON schema
8989
additionalProperties: single json schema
9090

@@ -103,4 +103,13 @@ At point of shutting down on 10th January 2025 I was wondering about how schemas
103103
I learnt that merging seems largely undefined in JSON Schema, as far as I can tell and I'm just going with a strategy of most recent field wins.
104104

105105
I've set up a Node::Schema class for common schema methods and Node::Schema::v3_0 and v3_1Up classes for specific changes. Need to flesh out
106-
tests and then behaviour that differs between them
106+
tests and then behaviour that differs between them.
107+
108+
Little things:
109+
- schema integer fields generally are required to be non-negative
110+
- quite common for arrays to be invalid if not unique (required, type)
111+
112+
JSON Schema specs:
113+
114+
meta: https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-00
115+
validation: https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-validation-00

0 commit comments

Comments
 (0)