curl --request POST \
--url https://api.iotools.cloud/v1/tool/openapi-v2-to-v3-converter \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"swaggerInput": "swagger: \"2.0\"\ninfo:\n title: Pet Store API\n description: A sample Swagger 2.0 spec\n version: \"1.0.0\"\nhost: api.petstore.example.com\nbasePath: /v1\nschemes:\n - https\nconsumes:\n - application/json\nproduces:\n - application/json\npaths:\n /pets:\n get:\n operationId: listPets\n summary: List all pets\n parameters:\n - name: limit\n in: query\n required: false\n type: integer\n format: int32\n responses:\n \"200\":\n description: A list of pets\n schema:\n type: array\n items:\n $ref: \"#/definitions/Pet\"\n post:\n operationId: createPet\n summary: Create a pet\n consumes:\n - application/json\n parameters:\n - name: body\n in: body\n required: true\n schema:\n $ref: \"#/definitions/NewPet\"\n responses:\n \"201\":\n description: Pet created\n schema:\n $ref: \"#/definitions/Pet\"\n /pets/{petId}/photo:\n post:\n operationId: uploadPetPhoto\n summary: Upload a photo for a pet\n consumes:\n - multipart/form-data\n parameters:\n - name: petId\n in: path\n required: true\n type: string\n - name: photo\n in: formData\n required: true\n type: file\n - name: caption\n in: formData\n required: false\n type: string\n responses:\n \"200\":\n description: Upload successful\nsecurityDefinitions:\n apiKeyAuth:\n type: apiKey\n in: header\n name: X-API-Key\n basicAuth:\n type: basic\ndefinitions:\n Pet:\n type: object\n required:\n - id\n - name\n properties:\n id:\n type: integer\n format: int64\n name:\n type: string\n tag:\n type: string\n x-nullable: true\n NewPet:\n type: object\n required:\n - name\n properties:\n name:\n type: string\n tag:\n type: string",
"outputFormat": "same",
"patchSpec": "true"
}
'{
"tool": "openapi-v2-to-v3-converter",
"tool_version": "1.0.1",
"outputs": {
"summary": [
{
"metric": "Input",
"value": "Swagger 2.0"
},
{
"metric": "Output",
"value": "OpenAPI 3.0.3"
},
{
"metric": "Endpoints",
"value": "3"
},
{
"metric": "Schemas",
"value": "2"
},
{
"metric": "Errors",
"value": "0"
},
{
"metric": "Warnings",
"value": "0"
},
{
"metric": "Notes",
"value": "0"
}
],
"issues": [],
"convertedOutput": "openapi: 3.0.3\ninfo:\n title: Pet Store API\n description: A sample Swagger 2.0 spec\n version: 1.0.0\nservers:\n - url: https://api.petstore.example.com/v1\npaths:\n /pets:\n get:\n summary: List all pets\n operationId: listPets\n parameters:\n - name: limit\n in: query\n required: false\n schema:\n type: integer\n format: int32\n responses:\n \"200\":\n description: A list of pets\n content:\n application/json:\n schema:\n type: array\n items:\n $ref: \"#/components/schemas/Pet\"\n post:\n summary: Create a pet\n operationId: createPet\n requestBody:\n required: true\n content:\n application/json:\n schema:\n $ref: \"#/components/schemas/NewPet\"\n responses:\n \"201\":\n description: Pet created\n content:\n application/json:\n schema:\n $ref: \"#/components/schemas/Pet\"\n /pets/{petId}/photo:\n post:\n summary: Upload a photo for a pet\n operationId: uploadPetPhoto\n parameters:\n - name: petId\n in: path\n required: true\n schema:\n type: string\n requestBody:\n content:\n multipart/form-data:\n schema:\n type: object\n properties:\n photo:\n type: string\n format: binary\n caption:\n type: string\n required:\n - photo\n required: true\n responses:\n \"200\":\n description: Upload successful\ncomponents:\n schemas:\n Pet:\n type: object\n required:\n - id\n - name\n properties:\n id:\n type: integer\n format: int64\n name:\n type: string\n tag:\n type: string\n nullable: true\n NewPet:\n type: object\n required:\n - name\n properties:\n name:\n type: string\n tag:\n type: string\n securitySchemes:\n apiKeyAuth:\n type: apiKey\n name: X-API-Key\n in: header\n basicAuth:\n type: http\n scheme: basic\n"
},
"credits_used": 3,
"credits_remaining": null
}OpenAPI v2 to v3 Converter
Convert a Swagger 2.0 (OpenAPI v2) spec into OpenAPI 3.x — host/basePath/schemes become servers, definitions become components.schemas with every $ref rewritten, body/formData parameters become requestBody, and produces/consumes become per-response/per-request content maps. Accepts and emits YAML or JSON, and runs entirely in your browser.
curl --request POST \
--url https://api.iotools.cloud/v1/tool/openapi-v2-to-v3-converter \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"swaggerInput": "swagger: \"2.0\"\ninfo:\n title: Pet Store API\n description: A sample Swagger 2.0 spec\n version: \"1.0.0\"\nhost: api.petstore.example.com\nbasePath: /v1\nschemes:\n - https\nconsumes:\n - application/json\nproduces:\n - application/json\npaths:\n /pets:\n get:\n operationId: listPets\n summary: List all pets\n parameters:\n - name: limit\n in: query\n required: false\n type: integer\n format: int32\n responses:\n \"200\":\n description: A list of pets\n schema:\n type: array\n items:\n $ref: \"#/definitions/Pet\"\n post:\n operationId: createPet\n summary: Create a pet\n consumes:\n - application/json\n parameters:\n - name: body\n in: body\n required: true\n schema:\n $ref: \"#/definitions/NewPet\"\n responses:\n \"201\":\n description: Pet created\n schema:\n $ref: \"#/definitions/Pet\"\n /pets/{petId}/photo:\n post:\n operationId: uploadPetPhoto\n summary: Upload a photo for a pet\n consumes:\n - multipart/form-data\n parameters:\n - name: petId\n in: path\n required: true\n type: string\n - name: photo\n in: formData\n required: true\n type: file\n - name: caption\n in: formData\n required: false\n type: string\n responses:\n \"200\":\n description: Upload successful\nsecurityDefinitions:\n apiKeyAuth:\n type: apiKey\n in: header\n name: X-API-Key\n basicAuth:\n type: basic\ndefinitions:\n Pet:\n type: object\n required:\n - id\n - name\n properties:\n id:\n type: integer\n format: int64\n name:\n type: string\n tag:\n type: string\n x-nullable: true\n NewPet:\n type: object\n required:\n - name\n properties:\n name:\n type: string\n tag:\n type: string",
"outputFormat": "same",
"patchSpec": "true"
}
'{
"tool": "openapi-v2-to-v3-converter",
"tool_version": "1.0.1",
"outputs": {
"summary": [
{
"metric": "Input",
"value": "Swagger 2.0"
},
{
"metric": "Output",
"value": "OpenAPI 3.0.3"
},
{
"metric": "Endpoints",
"value": "3"
},
{
"metric": "Schemas",
"value": "2"
},
{
"metric": "Errors",
"value": "0"
},
{
"metric": "Warnings",
"value": "0"
},
{
"metric": "Notes",
"value": "0"
}
],
"issues": [],
"convertedOutput": "openapi: 3.0.3\ninfo:\n title: Pet Store API\n description: A sample Swagger 2.0 spec\n version: 1.0.0\nservers:\n - url: https://api.petstore.example.com/v1\npaths:\n /pets:\n get:\n summary: List all pets\n operationId: listPets\n parameters:\n - name: limit\n in: query\n required: false\n schema:\n type: integer\n format: int32\n responses:\n \"200\":\n description: A list of pets\n content:\n application/json:\n schema:\n type: array\n items:\n $ref: \"#/components/schemas/Pet\"\n post:\n summary: Create a pet\n operationId: createPet\n requestBody:\n required: true\n content:\n application/json:\n schema:\n $ref: \"#/components/schemas/NewPet\"\n responses:\n \"201\":\n description: Pet created\n content:\n application/json:\n schema:\n $ref: \"#/components/schemas/Pet\"\n /pets/{petId}/photo:\n post:\n summary: Upload a photo for a pet\n operationId: uploadPetPhoto\n parameters:\n - name: petId\n in: path\n required: true\n schema:\n type: string\n requestBody:\n content:\n multipart/form-data:\n schema:\n type: object\n properties:\n photo:\n type: string\n format: binary\n caption:\n type: string\n required:\n - photo\n required: true\n responses:\n \"200\":\n description: Upload successful\ncomponents:\n schemas:\n Pet:\n type: object\n required:\n - id\n - name\n properties:\n id:\n type: integer\n format: int64\n name:\n type: string\n tag:\n type: string\n nullable: true\n NewPet:\n type: object\n required:\n - name\n properties:\n name:\n type: string\n tag:\n type: string\n securitySchemes:\n apiKeyAuth:\n type: apiKey\n name: X-API-Key\n in: header\n basicAuth:\n type: http\n scheme: basic\n"
},
"credits_used": 3,
"credits_remaining": null
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
Response
Tool output
Show child attributes
Show child attributes
The tool's slug, echoing the {slug} in the request path.
Output-contract version for this tool.
Credits this call consumed, after any settlement refund. 0 when metering is disabled.
Credits left in the current monthly allowance, or null when metering is disabled.
Correlation id, also sent as x-request-id.
Was this page helpful?