swagger-converter
swagger-converter copied to clipboard
Referenced parameters are converted incorrectly
Spec: https://gist.githubusercontent.com/hkosova/49dc5ed081cf553e01a1182e11b2e4ca/raw/5ea6988984bd8a0c0b3a506ac13b9dac396a74bc/param-ref.yaml
swagger: '2.0'
info:
version: '1.0'
title: Parameter references
paths:
/report/{userId}:
get:
parameters:
- $ref: '#/parameters/userIdParam'
- $ref: '#/parameters/dateRangeParam'
responses:
200:
description: OK
/formPost:
post:
consumes:
- application/x-www-form-urlencoded
parameters:
- $ref: '#/parameters/formEmail'
- $ref: '#/parameters/formPassword'
responses:
200:
description: OK
/bodyPost:
post:
consumes:
- application/json
parameters:
- $ref: '#/parameters/bodyParam'
responses:
200:
description: OK
parameters:
dateRangeParam:
in: query
name: dateRange
type: string
enum:
- Today
- Yesterday
- LastWeek
default: Today
userIdParam:
in: path
name: userId
type: integer
required: true
formEmail:
in: formData
name: email
type: string
format: email
required: true
formPassword:
in: formData
name: password
type: string
format: password
required: true
bodyParam:
in: body
name: body
required: true
schema:
type: object
properties:
status:
type: string
required:
- status
Problems:
- Parameter
$refs are converted to:
parameters:
- schema:
$ref: '#/parameters/userIdParam'
- schema:
$ref: '#/parameters/dateRangeParam'
Should be:
parameters:
- $ref: '#/components/schemas/userIdParam'
- $ref: '#/components/schemas/dateRangeParam'
- Form and body parameters are converted in the same way as query/path parameters, but should be converted to
requestBodyinstead.
Fixed:
- Parameters reference components now.
- Top level body and formData parameters are converted to request bodies.
Not fixed:
- Path level formData and body parameters are not converted.
- References to top-level body/formData parameters reference
#/components/parametersinstead of#/components/requestBodies.