You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: versions/3.1.0.md
+32-23
Original file line number
Diff line number
Diff line change
@@ -2276,11 +2276,16 @@ This object is an extended subset of the [JSON Schema Specification Wright Draft
2276
2276
For more information about the properties, see [JSON Schema Core](https://tools.ietf.org/html/draft-wright-json-schema-00) and [JSON Schema Validation](https://tools.ietf.org/html/draft-wright-json-schema-validation-00).
2277
2277
Unless stated otherwise, the property definitions follow the JSON Schema.
2278
2278
2279
-
##### Properties
2279
+
##### Properties
2280
2280
2281
-
The following properties are taken directly from the JSON Schema definition and follow the same specifications:
2281
+
OpenAPI v3.1 is a JSON Schema vocabulary which eetends JSON Schema Core and Validation vocabularies. As such any keyword available for those vocabularies is by definition available in OpenAPI, and will work the exact same way, including but not limited to:
2282
2282
2283
2283
- title
2284
+
- type
2285
+
- required
2286
+
- allOf
2287
+
- oneOf
2288
+
- andOf
2284
2289
- multipleOf
2285
2290
- maximum
2286
2291
- exclusiveMaximum
@@ -2294,46 +2299,50 @@ The following properties are taken directly from the JSON Schema definition and
2294
2299
- uniqueItems
2295
2300
- maxProperties
2296
2301
- minProperties
2297
-
- required
2298
2302
- enum
2299
-
2300
-
The following properties are taken from the JSON Schema definition but their definitions were adjusted to the OpenAPI Specification.
2301
-
- type - Value MUST be a string. Multiple types via an array are not supported.
2302
-
- allOf - Inline or referenced schema MUST be of a [Schema Object](#schemaObject) and not a standard JSON Schema.
2303
-
- oneOf - Inline or referenced schema MUST be of a [Schema Object](#schemaObject) and not a standard JSON Schema.
2304
-
- anyOf - Inline or referenced schema MUST be of a [Schema Object](#schemaObject) and not a standard JSON Schema.
2305
-
- not - Inline or referenced schema MUST be of a [Schema Object](#schemaObject) and not a standard JSON Schema.
2306
-
- items - Value MUST be an object and not an array. Inline or referenced schema MUST be of a [Schema Object](#schemaObject) and not a standard JSON Schema. `items` MUST be present if the `type` is `array`.
2307
-
- properties - Property definitions MUST be a [Schema Object](#schemaObject) and not a standard JSON Schema (inline or referenced).
2308
-
- additionalProperties - Value can be boolean or object. Inline or referenced schema MUST be of a [Schema Object](#schemaObject) and not a standard JSON Schema. Consistent with JSON Schema, `additionalProperties` defaults to `true`.
2303
+
- propertyNames
2304
+
- contains
2305
+
- const
2306
+
- examples
2307
+
- if / then / else
2308
+
- dependentRequired / dependentSchemas
2309
+
- deprecated
2310
+
- additionalItems
2311
+
- additionalProperties
2312
+
- unevaluatedItems
2313
+
- unevaluatedProperties
2314
+
- maxContains
2315
+
- minContains
2316
+
- readOnly
2317
+
- writeOnly
2318
+
2319
+
The following properties are taken from the JSON Schema definition but their definitions were adjusted to the OpenAPI Specification.
2320
+
2321
+
- exclusiveMinimum - Value can be a numeric value just like JSON Schema, or for backwards compatibility with older drafts it can accept a boolean to act as a modifier to the `minimum` keyword. The numeric value usage is recommended.
2322
+
- exclusiveMaximum - Value can be a numeric value just like JSON Schema, or for backwards compatibility with older drafts it can accept a boolean to act as a modifier to the `minimum` keyword. The numeric value usage is recommended.
2309
2323
- description - [CommonMark syntax](http://spec.commonmark.org/) MAY be used for rich text representation.
2310
2324
- format - See [Data Type Formats](#dataTypeFormat) for further details. While relying on JSON Schema's defined formats, the OAS offers a few additional predefined formats.
2311
-
- default - The default value represents what would be assumed by the consumer of the input as the value of the schema if one is not provided. Unlike JSON Schema, the value MUST conform to the defined type for the Schema Object defined at the same level. For example, if `type` is `string`, then `default` can be `"foo"` but cannot be `1`.
2325
+
- default - The value MUST conform to the defined type for the Schema Object defined at the same level. For example, if `type` is `string`, then `default` can be `"foo"` but cannot be `1`. This differs from JSON Schema which only RECOMMENDS the default conforms to the schema.
2312
2326
2313
2327
Alternatively, any time a Schema Object can be used, a [Reference Object](#referenceObject) can be used in its place. This allows referencing definitions instead of defining them inline.
2314
2328
2315
-
Additional properties defined by the JSON Schema specification that are not mentioned here are strictly unsupported.
2316
-
2317
-
Other than the JSON Schema subset fields, the following fields MAY be used for further schema documentation:
2329
+
In addition to the JSON Schema fields, the following OpenAPI vocabulary fields MAY be used for further schema documentation:
2318
2330
2319
2331
##### Fixed Fields
2320
2332
Field Name | Type | Description
2321
2333
---|:---:|---
2322
-
<a name="schemaNullable"></a>nullable | `boolean` | Allows sending a `null` value for the defined schema. Default value is `false`.
2334
+
<a name="schemaNullable"></a>nullable | `boolean` | Allows sending a `null` value for the defined schema. Default value is `false`. Deprecated. Move towards using `"type": "null"` & type arrays , e.g: `"type": ["string", "null"]`.
2323
2335
<a name="schemaDiscriminator"></a>discriminator | [Discriminator Object](#discriminatorObject) | Adds support for polymorphism. The discriminator is an object name that is used to differentiate between other schemas which may satisfy the payload description. See [Composition and Inheritance](#schemaComposition) for more details.
2324
-
<a name="schemaReadOnly"></a>readOnly | `boolean` | Relevant only for Schema `"properties"` definitions. Declares the property as "read only". This means that it MAY be sent as part of a response but SHOULD NOT be sent as part of the request. If the property is marked as `readOnly` being `true` and is in the `required` list, the `required` will take effect on the response only. A property MUST NOT be marked as both `readOnly` and `writeOnly` being `true`. Default value is `false`.
2325
-
<a name="schemaWriteOnly"></a>writeOnly | `boolean` | Relevant only for Schema `"properties"` definitions. Declares the property as "write only". Therefore, it MAY be sent as part of a request but SHOULD NOT be sent as part of the response. If the property is marked as `writeOnly` being `true` and is in the `required` list, the `required` will take effect on the request only. A property MUST NOT be marked as both `readOnly` and `writeOnly` being `true`. Default value is `false`.
2326
2336
<a name="schemaXml"></a>xml | [XML Object](#xmlObject) | This MAY be used only on properties schemas. It has no effect on root schemas. Adds additional metadata to describe the XML representation of this property.
2327
-
<a name="schemaExternalDocs"></a>externalDocs | [External Documentation Object](#externalDocumentationObject) | Additional external documentation for this schema.
2337
+
<a name="schemaExternalDocs"></a>externalDocs | [External Documentation Object](#externalDocumentationObject) | Additional external documentation for this schema.
2328
2338
<a name="schemaExample"></a>example | Any | A free-form property to include an example of an instance for this schema. To represent examples that cannot be naturally represented in JSON or YAML, a string value can be used to contain the example with escaping where necessary.
2329
-
<a name="schemaDeprecated"></a> deprecated | `boolean` | Specifies that a schema is deprecated and SHOULD be transitioned out of usage. Default value is `false`.
2330
2339
2331
2340
This object MAY be extended with [Specification Extensions](#specificationExtensions).
2332
2341
2333
2342
###### <a name="schemaComposition"></a>Composition and Inheritance (Polymorphism)
2334
2343
2335
2344
The OpenAPI Specification allows combining and extending model definitions using the `allOf` property of JSON Schema, in effect offering model composition.
2336
-
`allOf`takes an array of object definitions that are validated *independently* but together compose a single object.
2345
+
`allOf`takes an array of object definitions that are validated *independently* but together compose a single object.
2337
2346
2338
2347
While composition offers model extensibility, it does not imply a hierarchy between the models.
2339
2348
To support polymorphism, the OpenAPI Specification adds the `discriminator` field.
0 commit comments