OpenAPI.NET icon indicating copy to clipboard operation
OpenAPI.NET copied to clipboard

Parsing scientific notation is failing for integer fields

Open Mielek opened this issue 1 year ago • 0 comments

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.

Mielek avatar Jul 17 '24 11:07 Mielek