| title | OpenAPI 3.2: Prefer dataValue and serializedValue in example responses | ||
|---|---|---|---|
| parentIssue | 1673 | ||
| labels |
|
||
| assignees | |||
| milestone |
OpenAPI 3.2 adds two new fields to the Example Object:
dataValue— the example expressed as a structured (parsed) value, analogous to the existingvaluefield.serializedValue— the example as it would appear on the wire, as a string.
The existing externalValue is now explicitly documented as a serialized value.
Counterfact's random-response logic reads the value field from Example Objects when returning example responses. The new dataValue and serializedValue fields are not recognised.
- When selecting an example response, prefer
dataValueovervalueso that structured data is used correctly (update the response-building / example-selection logic, likely in the server dispatcher or response helper) - Optionally support
serializedValuefor content types where the wire format differs from the parsed form (e.g.application/x-www-form-urlencoded) - Ensure backward compatibility: fall back to
valuewhendataValueis absent
- An example with
dataValueis returned as the response body in preference tovalue - An example with only
value(and nodataValue) continues to be returned correctly -
serializedValueis returned verbatim as the response body for appropriate content types - Existing behaviour for specs that do not use
dataValueorserializedValueis unchanged - A unit test covers each of the three cases:
dataValuepresent,value-only, andserializedValue