swagger-api / swagger-api/swagger-ui

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

Open
#10,610 3 comments 0 reactions 1 assignee View on GitHub

@Halcyonic-01 is already working on this.

Since Oct 30, 2025.

P3 pull-request-welcome type: bug
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 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

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.