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.

Model3.1 and 3.23.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: 0minimum: 0, exclusiveMinimum: true (same for maximum)
const('admin')const: adminenum: [admin]
examples(9.99, 20) on a schemaexamples: [9.99, 20]example: 9.99
type('string', 'integer')type: [string, integer]anyOf: [{type: string}, {type: integer}]
Schema::ref('User')->description('…')$ref with its siblingsallOf: [{$ref}] with the siblings
contentMediaType('image/png')contentMediaType: image/pngformat: binary
contentEncoding('base64')contentEncoding: base64format: 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 paths is written with paths: {} 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() and Reference::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 contentEncoding other than base64 (such as base64url), a contentMediaType with an encoding other than base64, a const outside the enum of 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() and MediaType::ref();
  • Server::name();
  • Operation::query() and PathItem::query(), PathItem::additionalOperations();
  • Parameter::querystring(), and the cookie style;
  • Tag::summary(), parent() and kind();
  • MediaType::description(), itemSchema(), prefixEncoding() and itemEncoding(), and the encoding, prefixEncoding and itemEncoding of an Encoding;
  • Example::dataValue() and serializedValue();
  • Discriminator::defaultMapping(), Xml::nodeType();
  • OAuthFlows::deviceAuthorization(), OAuthFlow::deviceAuthorizationUrl();
  • SecurityScheme::oauth2MetadataUrl() and deprecated();
  • Response::summary().

Webhooks and tag parents can be kept for Redoc in older versions; see Redoc extensions.