Skip to content

Release 2.12

Latest

Choose a tag to compare

@igorpocta igorpocta released this 03 Nov 16:15

What's Changed

Features

  • Named examples for polymorphic request bodies. Swagger UI drops the discriminator property from the "Try it out" sample when the request body root schema is oneOf + discriminator, so every request from Swagger failed with 422 Missing discriminator property. application/json request bodies referencing a polymorphic schema with #[Discriminator(mapping: ...)] now get content.application/json.examples – one example per mapping key, in mapping order:
    • key = discriminator value, summary = variant #[Schema(title:)] or schema name, description = variant description
    • value is composed only from what the variant declares: discriminator value (always first), property example, single-value enum, nested $ref objects (max 3 levels, cycles skipped), arrays of $ref objects (one item), first oneOf variant. readOnly / deprecated properties and properties without a value are omitted – nothing is invented.
    • Responses and multipart bodies are not affected.

⚠️ Check before upgrading

Change What to check
Hand-written example / examples on #[JsonContent(ref: ...)] in #[RequestBody] were silently dropped; they are now emitted (and suppress generated examples) stale hand-written examples now visible in the spec
Polymorphic request bodies gain examples in the spec snapshot tests of the generated spec

Full Changelog: v2.11...v2.12