Versions and output
Conversions
What the library rewrites for OpenAPI 3.0, and what each version cannot express.
This page lists every difference between versions that the library handles: the ones it converts, and the features that do not exist in older versions.
Converted for OpenAPI 3.0
Written in another form for 3.0, and reported as converted diagnostics,
never as an error.
| Model | 3.1 and 3.2 | 3.0 |
|---|---|---|
Schema::string()->nullable() | type: [string, "null"] | type: string, nullable: true |
Schema::ref('User')->nullable() | anyOf: [{$ref}, {type: "null"}] | anyOf: [{$ref}, {enum: [null], type: object, nullable: true}] |
exclusiveMinimum(0) | exclusiveMinimum: 0 | minimum: 0, exclusiveMinimum: true (same for maximum) |
const('admin') | const: admin | enum: [admin] |
examples(9.99, 20) on a schema | examples: [9.99, 20] | example: 9.99 |
type('string', 'integer') | type: [string, integer] | anyOf: [{type: string}, {type: integer}] |
Schema::ref('User')->description('…') | $ref with its siblings | allOf: [{$ref}] with the siblings |
contentMediaType('image/png') | contentMediaType: image/png | format: binary |
contentEncoding('base64') | contentEncoding: base64 | format: byte |
items(true), items(false) | true, false | {}, {not: {}} |
Two more apply to every version:
- A response without description is written with
description: "", the field being required. - A document without
pathsis written withpaths: {}for 3.0, where the field is required.
Schema
Schema::number('price')
->exclusiveMinimum(0)
->examples(9.99, 20);
3.1.2 / 3.0.4
{ "type": "number", "exclusiveMinimum": 0, "examples": [9.99, 20] }
{ "type": "number", "minimum": 0, "exclusiveMinimum": true, "example": 9.99 }
Not available before 3.1
Below 3.1, these throw an UnsupportedFeatureException in strict mode, and are dropped in lenient mode:
OpenApi::webhooks(),OpenApi::jsonSchemaDialect(),Components::pathItems();Info::summary(),License::identifier();Reference::summary()andReference::description();SecurityScheme::mutualTLS(), and scopes on a non-OAuth2 security requirement;- the schema keywords
$schema,$id,$anchor,$dynamicAnchor,$dynamicRef,$defs,$comment,contentSchema,prefixItems,contains,minContains,maxContains,unevaluatedItems,patternProperties,propertyNames,unevaluatedProperties,dependentRequired,dependentSchemas,if,then,else; - a
contentEncodingother thanbase64(such asbase64url), acontentMediaTypewith an encoding other than base64, aconstoutside theenumof its schema.
Extensions starting with x-oai- or x-oas- are reserved from 3.1, and rejected there.
Not available before 3.2
OpenApi::self(),Components::mediaTypes()andMediaType::ref();Server::name();Operation::query()andPathItem::query(),PathItem::additionalOperations();Parameter::querystring(), and thecookiestyle;Tag::summary(),parent()andkind();MediaType::description(),itemSchema(),prefixEncoding()anditemEncoding(), and theencoding,prefixEncodinganditemEncodingof anEncoding;Example::dataValue()andserializedValue();Discriminator::defaultMapping(),Xml::nodeType();OAuthFlows::deviceAuthorization(),OAuthFlow::deviceAuthorizationUrl();SecurityScheme::oauth2MetadataUrl()anddeprecated();Response::summary().
Webhooks and tag parents can be kept for Redoc in older versions; see Redoc extensions.