Created
September 24, 2018 00:57
-
-
Save samngmco/cde06c0ccdf6296b6ab4b7afc55a0861 to your computer and use it in GitHub Desktop.
Sample swagger yaml file with path parameters and request body
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" | |
info: | |
description: "My API Description" | |
version: "1.0.0" | |
title: "My REST API" | |
termsOfService: "http://swagger.io/terms/" | |
contact: | |
email: "hello@world.com" | |
license: | |
name: "Apache 2.0" | |
url: "http://www.apache.org/licenses/LICENSE-2.0.html" | |
host: "localhost:8080" | |
schemes: | |
- "http" | |
paths: | |
/echo/{key1}/{key2}: | |
post: | |
summary: "Doing something." | |
description: "Tell the system to do something" | |
consumes: | |
- "application/json" | |
produces: | |
- "application/json" | |
parameters: | |
- $ref: "#/parameters/key1" | |
- $ref: "#/parameters/key2" | |
- in: "body" | |
name: "body" | |
required: true | |
schema: | |
$ref: "#/definitions/MyRequest" | |
responses: | |
200: | |
description: "Successfully done" | |
schema: | |
$ref: "#/definitions/MyResponse" | |
parameters: | |
key1: | |
name: "key1" | |
in: "path" | |
required: true | |
description: "key1" | |
type: "string" | |
key2: | |
name: "key2" | |
in: "path" | |
required: true | |
description: "key2" | |
type: "string" | |
definitions: | |
MyRequest: | |
type: "object" | |
required: | |
- "key1" | |
- "key2" | |
description: "My Request Object" | |
properties: | |
reqKey1: | |
type: "string" | |
example: "hello-word" | |
description: "request body key1" | |
reqKey2: | |
type: "string" | |
description: "request body key2" | |
example: "foobar" | |
MyResponse: | |
type: "object" | |
properties: | |
value1: | |
type: "string" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment