redoc icon indicating copy to clipboard operation
redoc copied to clipboard

Redoc taking lot of time to render documentation

Open prabhutw opened this issue 2 years ago • 7 comments

Describe the bug Redoc taking lot of time to load the page, Its taking approx 1 min to load the documentation

Expected behavior Redoc renders docs in few seconds

Additional context Browser: chrome, firefox

We are getting 12000+ warnings mentioned below in console and page is rendered only after 1 min, till then it was just showing loading icon. And the memory used by javascript VM instance is 1875MB

Size of spec(yaml): 42KB

Warning messages:

(index):16 Incompatible types in allOf at "#/components/schemas/FormFieldComponent/oneOf/7/properties/label": "object" and "string"
value @ (index):16
(index):16 Incompatible types in allOf at "#/components/schemas/FormFieldComponent/oneOf/7/properties/hint": "object" and "string"
value @ (index):16
(index):16 Incompatible types in allOf at "#/components/schemas/FormFieldComponent/oneOf/7/properties/placeholder": "object" and "string"

prabhutw avatar Dec 01 '21 11:12 prabhutw

openapi.txt

This is the file having API spec in YAML format causing the above issue

prabhutw avatar Dec 03 '21 12:12 prabhutw

try removing the - on the type field and repositioning the allOf reference. allOf needs a property association

should look like this:

    FormFieldComponent:
      type: object
      properties:
        components:
          allOf:
            - $ref: '#/components/schemas/DataComponent'
            - $ref: '#/components/schemas/Component'
        label:
          type: string
        hint:
          type: string
        placeholder:
          type: string
        apply:
          $ref: '#/components/schemas/Apply'

jeremyfiel avatar Dec 14 '21 03:12 jeremyfiel

@jeremyfiel We generated this YAML using micronaut-openapi(io.micronaut.openapi:micronaut-openapi:3.2.0).

Does that mean it is generated file in wrong format ?

And we don't have a property named "components" in FormFieldComponent

  • DataComponent extends Component
  • FormFieldComponent extends DataComponent

Hence the file is generated is like this

prabhutw avatar Dec 17 '21 07:12 prabhutw

@prabhutw I may have misunderstood it previously.

I think it may be associated to this https://github.com/Redocly/redoc/issues/907

sounds like it may not be able to discriminate between object <> string in your oneOf declaration

jeremyfiel avatar Dec 17 '21 14:12 jeremyfiel

Thanks for pointing it out @jeremyfiel But converting the error to warning did not solve the issue. What could be fix for this issue? I can contribute for this

prabhutw avatar Dec 22 '21 08:12 prabhutw

Can someone help to resolve this issue?

In chrome browser, its taking 2014MB of heap size

prabhutw avatar Jan 04 '22 09:01 prabhutw

Just ran into the same issue. Causes Chrome to crash. Not a complicated schema

davidhenley avatar Nov 01 '23 22:11 davidhenley