swagger-editor icon indicating copy to clipboard operation
swagger-editor copied to clipboard

Generated client -> html -> index.html - doesn't format code blocks to wrap long http responses

Open ipepe opened this issue 8 months ago • 0 comments

Q&A (please complete the following information)

  • OS: macOS
  • Browser: chrome
  • Version: 120.0.6099.71
  • Method of installation: visiting webpage https://editor-next.swagger.io/
  • Swagger-Editor version: 5.0.0-alpha.83
  • Swagger/OpenAPI version: OpenAPI openapi: 3.0.3

Content & configuration

Example Swagger/OpenAPI definition:

        '400':
          description: With invalid params responds bad request
          content:
            application/json:
              schema:
                type: object
                properties:
                  errors:
                    type: object
                    properties:
                      base:
                        type: array
                        items:
                          type: string
                    required:
                    - base
                required:
                - errors
              example:
                errors:
                  base:
                  - did not contain a required property of 'base'
                  - did not contain a required property of 'base'
                  - did not contain a required property of 'base'
                  - did not contain a required property of 'base'
                  - did not contain a required property of 'base'
                  - did not contain a required property of 'base'
                  - did not contain a required property of 'base'
                  - did not contain a required property of 'base'
                  - did not contain a required property of 'base'
                  - did not contain a required property of 'base'
                  - did not contain a required property of 'base'

Swagger-Editor configuration options:

SwaggerEditor({
  // your config options here
})
?yourQueryStringConfig

Describe the bug you're encountering

When exporting a swagger documentation that has long example response, then generate client -> html returns html that contains <code tag that doesn't word wrap. It needs it have style of white-space: pre-wrap;

To reproduce...

Steps to reproduce the behavior:

  1. Import swagger documentation that contains really long response
  2. Generate client -> HTML
  3. Open generated index.html
  4. Example response is overflowing the page in <code> tag

Expected behavior

I expected that generated index.html doesn't require to scroll horizontally to see full response.

Screenshots

Screenshot 2023-12-11 at 12 34 37

Additional context or thoughts

I could probably implement necessary change, but I have no idea where html generate client code lives

ipepe avatar Dec 11 '23 11:12 ipepe