Redocly / redoc

📘 OpenAPI/Swagger-generated API Reference Documentation
https://redocly.github.io/redoc/
MIT License
22.98k stars 2.27k forks source link

[Bug] Showing extensions with long values causes rendering issues #1581

Open codyaray opened 3 years ago

codyaray commented 3 years ago

We have an extension x-extensible-enum that, when the number of items in the list goes beyond a certain limit, causes rendering issues in the HTML. We're passing --options.showExtensions=x-extensible-enum to Redoc CLI bundle.

You can see the rendering effects when the sub-object is exanded here:

Screen Shot 2021-04-14 at 1 54 11 PM

Instead of wrapping to a new line, the extension list keeps growing. You can see it behind the right panel, and you also see strange horizontal line rendering artifacts as well. Also notice that the field description lines are no longer wrapping, on both the field with the extension and the other field as well.

When its collapsed, everything appears normally:

Screen Shot 2021-04-14 at 1 54 02 PM

Here's a minimal reproducible example:

openapi: 3.0.0
info:
  title: Support API
  version: 1.0.0

paths:
  /support/v1/organizations:
    post:
      summary: Create an Organization
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/support.v1.Organization'
components:
  schemas:
    support.v1.Organization:
      type: object
      description: Search, create or update support organizations
      properties:
        name:
          type: string
          description: A unique name for the organization. This has to be globally unique. Otherwise bad things happen. Like long lines of text that don't break.
          example: An Organization
        organization_fields:
          type: object
          properties:
            timezone:
              type: string
              description: Primary Timezone
              default: gmtminus7
              example: gmtminus7
              x-extensible-enum:
                - gmtplus0
                - gmtplus1
                - gmtplus2
                - gmtplus3
                - gmtplus4
                - gmtplus5
                - gmtplus6
                - gmtplus7
                - gmtplus8
                - gmtplus9
                - gmtplus10
                - gmtplus11
                - gmtplus12
                - gmtplus13
                - gmtplus14
                - gmtminus11
                - gmtminus10
                - gmtminus9
                - gmtminus8
                - gmtminus7
                - gmtminus6
                - gmtminus5
                - gmtminus4
                - gmtminus3
                - gmtminus2
                - gmtminus1
          description: Custom fields for this organization
      additionalProperties: false

This was build using redoc-cli as

$ redoc-cli --version
0.9.13

$ redoc-cli bundle openapi.yaml --output openapi.html --options.showExtensions=x-extensible-enum
Prerendering docs

🎉 bundled successfully in: openapi.html (958 KiB) [⏱ 0.203s]
codyaray commented 3 years ago

Hi - can someone take a look a tthis?

codyaray commented 2 years ago

Just ran into this again with a new API. Can anyone take a look? 🙏

codyaray commented 1 year ago

Hello there! More than a year has passed. Plleaaaseeee

RomanHotsiy commented 1 year ago

Hey @codyaray.

PRs are welcome 🙌

codyaray commented 1 year ago

Alas, React and frontend tooling in general is my kryptonite. But thank you for responding, regardless. :)