redoc icon indicating copy to clipboard operation
redoc copied to clipboard

OpenAPI Sampler: found allOf with "array" type. Result may be incorrect

Open pintux opened this issue 7 years ago • 9 comments

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

pintux avatar May 09 '19 07:05 pintux

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

RomanHotsiy avatar May 09 '19 09:05 RomanHotsiy

Once I implement proper array merging, this warning will be removed

RomanHotsiy avatar May 09 '19 09:05 RomanHotsiy

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.

maxlapshin avatar Nov 05 '21 12:11 maxlapshin

I would also like to know an example of how this warning is triggered

HenrikHL avatar May 31 '22 06:05 HenrikHL

Same.

Profpatsch avatar Jun 12 '22 10:06 Profpatsch

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

jfoclpf avatar Dec 19 '22 20:12 jfoclpf

I just encountered this. I'd like to request one of two things:

  1. when redocly emits this warning, redocly outputs the file and line number (or yaml path) at which this warning was detected
  2. 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.

mjperrone avatar Oct 13 '23 16:10 mjperrone

@RomanHotsiy Was proper array merging ever implemented? If not, would it not be better to reopen this issue?

darcyrush avatar Jun 12 '25 15:06 darcyrush

This is still an issue, having the line number that triggered this error would be beneficial.

Rnfudge02 avatar Nov 07 '25 07:11 Rnfudge02