Created
November 14, 2016 15:45
-
-
Save marians/0c9ad72aa700a7afd2fb15dd3d3b10b3 to your computer and use it in GitHub Desktop.
How to avoid repeating a parameter definition in an Open API 2.0 spec?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
swagger: "2.0" | |
host: api.example.com | |
schemes: | |
- https | |
info: | |
title: An Example API Spec | |
version: "1" | |
paths: | |
/users/{user_id}/: | |
get: | |
operationId: getUser | |
summary: Get user details | |
parameters: | |
- name: user_id | |
in: path | |
required: true | |
type: string | |
responses: | |
"200": | |
description: Success | |
patch: | |
operationId: updateUser | |
summary: Update user details | |
parameters: | |
- name: user_id | |
in: path | |
required: true | |
type: string | |
responses: | |
"204": | |
description: Success | |
delete: | |
operationId: deleteUser | |
summary: Delete a user | |
parameters: | |
- name: user_id | |
in: path | |
required: true | |
type: string | |
responses: | |
"204": | |
description: Success | |
parameters: | |
userIdUrlParam: | |
name: user_id | |
in: path | |
description: User ID | |
required: true | |
type: string |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How to replace the three definitions of the parameter
user_id
with references to#/parameters/userIdUrlParam
?