Repository navigation
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 422Missing discriminator property.application/jsonrequest bodies referencing a polymorphic schema with#[Discriminator(mapping: ...)]now getcontent.application/json.examples– one example per mapping key, in mapping order:- key = discriminator value,
summary= variant#[Schema(title:)]or schema name,description= variant description valueis composed only from what the variant declares: discriminator value (always first), propertyexample, single-valueenum, nested$refobjects (max 3 levels, cycles skipped), arrays of$refobjects (one item), firstoneOfvariant.readOnly/deprecatedproperties and properties without a value are omitted – nothing is invented.- Responses and multipart bodies are not affected.
- key = discriminator value,
⚠️ 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