Skip to content

In a x-www-form-urlencoded request body, string param value '1.0' is rewritten as '1' #10610

@sotty

Description

@sotty

Q&A (please complete the following information)

  • OS: Windows 11
  • Browser: Chrome
  • Version: 122.0.x
  • Method of installation: via quarkus-swagger-ui, but also editor.swagger.io
  • Swagger-UI version: 5.20.8 .. 5.29.4
  • Swagger/OpenAPI version: OpenAPI 3.0.1

Content & configuration

Reproducible on https://editor.swagger.io/

Example Swagger/OpenAPI definition:

openapi: 3.0.1
info:
  title: Reproducer
  version: "1.0"
paths:

  /test:
    post:
      operationId: testOp
      requestBody:
        content:
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/Example'
      responses:
        200:
          description: "Success"
          
components:
  schemas:
    Example:
      type: object
      properties:
        versionTag:
          type: string
          default: "1.0"

Describe the bug you're encountering

My API exposes a POST endpoint with a 'version tag' attribute of type string.
When invoked through Swagger-UI "Try it out", the String "1.0" is parsed as
the value "1", which is then passed to the server.
Given that this a version tag, not a decimal number, the change is significant.

To reproduce...

Steps to reproduce the behavior:

  1. Use the given spec in editor.swagger.io
  2. Hit "try it out"
  3. See the actual CURL - the version tag value has been rewritten as '1'
curl -X 'POST' \
  'https://editor.swagger.io/test' \
  -H 'accept: */*' \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  -d 'versionTag=1'

Expected behavior

The version tag parameter value should be '1.0':

curl -X 'POST' \
  'https://editor.swagger.io/test' \
  -H 'accept: */*' \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  -d 'versionTag=1.0' 

Screenshots

Additional context or thoughts

Most likely related to #10047

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions