Skip to content

Is it possible to support convert Swagger2.0? #59

@gorillamoe

Description

@gorillamoe

Discussed in #58

Originally posted by shy-robin September 20, 2025
Thanks for your great plugin!
Does it support convert Swagger2.0(https://swagger.io/specification/v2/)?
I tried to run kulala-fmt convert swagger.json to covert a swagger json file to http file.
Although it can get http file successfully, it lacks of request body.
For example:
From:

{
  "schemes": [],
  "swagger": "2.0",
  "info": {
    "description": "",
    "title": "Swagger Test API",
    "contact": {},
    "version": "0.1"
  },
  "host": "",
  "basePath": "/api/v1",
  "paths": {
    "/account/test": {
      "post": {
        "description": "test-v1",
        "consumes": ["application/json"],
        "produces": ["application/json"],
        "tags": ["Account"],
        "summary": "test-v1",
        "parameters": [
          {
            "type": "string",
            "description": "token",
            "name": "Authorization",
            "in": "header",
            "required": true
          },
          {
            "description": "JSON",
            "name": "request",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/Demo.TestReq"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "schema": {
              "$ref": "#/definitions/Demo.TestResp"
            }
          }
        }
      }
    }
  },
  "definitions": {
    "Demo.TestReq": {
      "type": "object",
      "properties": {
        "user_id": {
          "type": "integer"
        }
      }
    }
  }
}

To:

###

# test-v1
# test-v1
POST /account/test HTTP/1.1
Authorization: {{Authorization}}

I expect this result:

###

# test-v1
# test-v1
POST /account/test HTTP/1.1
Authorization: {{Authorization}}

{
    user_id: 0
}
```</div>

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions