Array description guideline#559
Conversation
|
Case B shows the property items referencing a schema that itself is an array. That results in an array-of-arrays, maybe this would be sufficient: |
Co-authored-by: Rafal Artych <121048129+rartych@users.noreply.github.com>
Yes, i agree. Thanks for the catch-up. Will also name to <schema-array-name> |
|
Can you add another example, when a $ref keyword is used for the item data type? |
Thinking about the comment, guess we can add other scenario covering that:
components:
schemas:
<schema-name>:
type: object
properties:
<property-name>:
$ref: "#/components/schemas/<schema-array-name>"
...
<schema-array-name>:
type: array
items:
$ref: "#/components/schemas/<schema-item-name>"
...
<schema-item-name>:
type: object
properties:
<item-object-property1-name>:
type: string
description: <description>
<item-object-property2-name>:
type: boolean
description: <description> |
|
Thx |
…o array_response_description_guidance
1af827b
|
I have returned to that proposal and I see some changes are needed:
responses:
"2xx":
description: <description>
headers:
x-correlator:
$ref: "#/components/headers/x-correlator"
content:
application/json:
schema:
$ref: "#/components/schemas/<schema-name>"
"4xx":
$ref: "#/components/responses/<schema-name>"
"5xx":
$ref: "#/components/responses/<schema-name>"We can clarify it with changing
components:
schemas:
<success-reponse-schema-name>:
type: array
items:
type: string
description: <description>
components:
schemas:
<success-reponse-schema-name>:
type: object
properties:
<property-name>:
description: <description>
type: array
$ref: "#/components/schemas/<schema-array-item>"
...
<schema-array-item>:
description: <description>
type: stringThe example is in - Device reachability status API Redoc - I modified it to follow this template
components:
schemas:
<success-reponse-schema-name>:
type: object
properties:
<property-name>:
$ref: "#/components/schemas/<schema-array-name>"
...
<schema-array-name>:
type: array
description: <description>
items:
type: string
description: <description>The example with the same Device reachability status API Redoc - different branch In summary:
If needed we can think of guidelines for array schema definitions in 5.8.1. |
To me is fine. I make adjustements. We can document Case A for now |
What type of PR is this?
What this PR does / why we need it:
This PR manages the cases when a response or specific field is an array so as their description is well renderized.
It applies for #547:
For request scenarios guideline already exists 5.7.5. Request Bodies
For response scenarios this PR adds a guideline in section 5.8.2. Responses
Which issue(s) this PR fixes:
Fixes #547
Does this PR introduce a breaking change?
Special notes for reviewers:
Changelog input
Additional documentation
This section can be blank.