OpenAPI Sampler: found allOf with "array" type. Result may be incorrect
Using 2.0.0-rc.4 with an OpenAPI spec 3.0.2 file, in the browser console it rises a lot of warnings of type: "OpenAPI Sampler: found allOf with "array" type. Result may be incorrect".
What does it mean?
My OpenAPI spec 3.0.2 json file validates correctly using another tool like https://github.com/Mermade/oas-kit
ReDoc tries to merge allOf for sakes of better UX. But merging allOf with array is tricky so, for now, I implemented the simplest variant and print warning.
If your docs look correct, you can ignore this warning
Once I implement proper array merging, this warning will be removed
Can you give example of such type spec that rises this warning?
I have 20 000 lines of yaml and it is not easy to find, what exactly redoc doesn't like.
I would also like to know an example of how this warning is triggered
Same.
I think this is a bug, my openapi file does not have any allOf
In my case it triggers when I have a schema having an array of objects
schemas:
freguesias:
type: array
items:
type: object
properties:
codigo:
type: string
example: 9712
...
and then I reference it with oneOf
responses:
'200':
description: Freguesia selecionada(s)
content:
application/json:
schema:
oneOf:
- $ref: '#/components/schemas/freguesia'
- $ref: '#/components/schemas/freguesias'
One of the possible results is an Array of Objects (when the amount of results is >=2), whereas when the result length is 1, I just output the Object itself.
Not only I get this warning, but also the documentation UI is not rendered properly
I just encountered this. I'd like to request one of two things:
- when redocly emits this warning, redocly outputs the file and line number (or yaml path) at which this warning was detected
- a minimal example posted in this thread which triggers the error so people can at least see an example to pattern match against their own code
Currently, it is not easy to find where this warning is complaining about, so it is very challenging to understand and address it.
@RomanHotsiy Was proper array merging ever implemented? If not, would it not be better to reopen this issue?
This is still an issue, having the line number that triggered this error would be beneficial.