Skip to content

Commit

Permalink
fix: tag parameters fix
Browse files Browse the repository at this point in the history
fixes issue #17
  • Loading branch information
Anton Koshkin committed Feb 12, 2019
1 parent 57694b1 commit eb521d0
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 25 deletions.
1 change: 1 addition & 0 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ const getTagWithResolvedParameters = (
) => (tag: TOperationObject): TOperationObject => ({
...tag,
parameters: tag.parameters
.alt(some([]))
.map(addPathParametersToTag)
.map(parameters => parameters.map(resolveTagParameter))
.chain(sequence(option, array)),
Expand Down
78 changes: 53 additions & 25 deletions test/specs/yaml/swagger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,13 @@ paths:
- read:pets
deprecated: true
"/pet/{petId}":
parameters:
- name: petId
in: path
description: ID of pet to return
required: true
type: integer
format: int64
get:
tags:
- pet
Expand All @@ -168,13 +175,6 @@ paths:
produces:
- application/xml
- application/json
parameters:
- name: petId
in: path
description: ID of pet to return
required: true
type: integer
format: int64
responses:
'200':
description: successful operation
Expand All @@ -198,12 +198,6 @@ paths:
- application/xml
- application/json
parameters:
- name: petId
in: path
description: ID of pet that needs to be updated
required: true
type: integer
format: int64
- name: name
in: formData
description: Updated name of the pet
Expand Down Expand Up @@ -235,12 +229,6 @@ paths:
in: header
required: false
type: string
- name: petId
in: path
description: Pet id to delete
required: true
type: integer
format: int64
responses:
'400':
description: Invalid ID supplied
Expand All @@ -251,6 +239,13 @@ paths:
- write:pets
- read:pets
"/pet/{petId}/uploadImage":
parameters:
- name: petId
in: path
description: ID of pet to update
required: true
type: integer
format: int64
post:
tags:
- pet
Expand All @@ -262,12 +257,6 @@ paths:
produces:
- application/json
parameters:
- name: petId
in: path
description: ID of pet to update
required: true
type: integer
format: int64
- name: additionalMetadata
in: formData
description: Additional data to pass to server
Expand Down Expand Up @@ -602,6 +591,45 @@ paths:
description: success
schema:
type: string
/test/{Param1}/{Param2}:
parameters:
- $ref: '#/parameters/Param1pathParam'
- $ref: '#/parameters/Param2pathParam'
get:
tags:
- test
summary: Some summary
description: ''
operationId: checkSeveralParameterInPath
produces:
- application/xml
- application/json
responses:
200:
description: successful operation
schema:
"$ref": "./common.yml#/definitions/User"
400:
description: Invalid username supplied
404:
description: User not found
parameters:
Param1pathParam:
name: Param1
in: path
description: Param1
required: true
type: string
minLength: 1
maxLength: 64
Param2pathParam:
name: Param2
in: path
description: Param2
required: true
type: string
minLength: 1
maxLength: 64
securityDefinitions:
petstore_auth:
type: oauth2
Expand Down

0 comments on commit eb521d0

Please sign in to comment.