swagger-api / swagger-api/swagger-ui

OpenAPI 3.1.0 support: MultipleOf with most than 6 digits doesn't work

Open
#9,276 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
29k
Forks
9.3k
Avg merge
2d 23h
Merged PRs (30d)
25

Description

Q&A (please complete the following information)
  • OS: Windows
  • Browser: Firefox
  • Version: 118.0.1
  • Method of installation: online and dist
  • Swagger-UI version: Swagger 5.0.0-alpha.77
  • OpenAPI version: OpenAPI 3.1.0

No bug with OpenAPI 3.0.3

Content & configuration

Example Swagger/OpenAPI definition:

openapi: 3.1.0
info:
  description: description
  title: test api
  version: "1.0"
servers:
- url: /test-ws/v1/
paths:
  /test:
    get:
      operationId: test
      parameters:
      - explode: true
        in: query
        name: search
        required: false
        schema:
          $ref: '#/components/schemas/test'
        style: form
      responses:
        default:
          content:
            application/json:
              schema:
                items:
                  $ref: '#/components/schemas/test'
                type: array
          description: default response
components:
  schemas:
    test:
      description: margin added at variable rate
      maximum: 10000000000
      minimum: 0
      multipleOf: 0.0000001             # WORK IF 0.000001 (6 digits)
      title: Margin on variable rate
      type: number

Swagger-UI configuration options:
NO

Describe the bug you're encountering

When I use OpenAPI 3.1.0 with the online swagger editor (5.0.0-alpha.77) or the dist swagger editor,
The use of multipleOf with more than 6 digits create an error.

Error in the editor : Could not render od, see the console.

t.toString().split(...)[1] is undefined in the file [react-dom.production.min.js:216:234](https://editor-next.swagger.io/static/node_modules/react-dom/cjs/react-dom.production.min.js)

Note : With OpenAPI 3.0.3 and swagger-editor online 5.0.0-alpha.77 there is no problem

To reproduce

Steps to reproduce the behavior:

  1. Go to https://editor-next.swagger.io/
  2. Past the previous example
  3. See error

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the example in https://editor-next.swagger.io/ using OpenAPI 3.1.0 and multipleOf: 0.0000001, then inspect the browser console and the editor rendering path around the reported react-dom error. Done means the definition renders without an error for more than six fractional digits while the existing OpenAPI 3.0.3 behavior remains unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, openapi
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.