Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parsing scientific notation is failing for integer fields #1730

Open
Mielek opened this issue Jul 17, 2024 · 0 comments
Open

Parsing scientific notation is failing for integer fields #1730

Mielek opened this issue Jul 17, 2024 · 0 comments

Comments

@Mielek
Copy link

Mielek commented Jul 17, 2024

Describe the bug
Framework is failing to parse the document with scientific notation values for integers properties with message like Failed to parse input: The input string '1.1e3' was not in a correct format..

I identified following list of properties which show that issue. This list is definitely not exhaustive.

  1. maxItems
  2. minItems
  3. maxProperties
  4. minProperties
  5. maxLength
  6. minLength

OpenApi File To Reproduce

swagger: '2.0'
info:
  version: 1.0.0
  title: Swagger Petstore
host: petstore.swagger.io
produces:
  - application/json
schemes:
  - https
paths:
  /pets:
    get:
      responses:
        '200':
          description: Should parse properties with e format
          schema:
            type: object
            properties: 
              items:
                type: array
                maxItems: 1.1e3
                minItems: 1.2e1
                items:
                  type: string
              props:
                type: object
                maxProperties: 1.3e2
                minProperties: 1.4e1
                additionalProperties: true
              length:
                type: string
                maxLength: 1.5e2
                minLength: 1.6e1

Expected behaviour
Parse should succeed for all the values which are positive integers.
Example of correct values: 1e0, 1.1e1, 1.01e2, 10e-1
Example of incorrect values: 1e-1, 0.1e0, 1.01e1

Screenshots/Code Snippets
image

Additional context
I was checking in the https://editor.swagger.io/ and parsing is successful for integers in scientific notation. For a fraction number in scientific notation the editor is failing to parse the document.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant