@microsoft.azure/autorest.testserver
Version:
Autorest test server.
213 lines (212 loc) • 6.4 kB
JSON
{
"swagger": "2.0",
"info": {
"version": "2.0-preview",
"title": "Media Types Client",
"description": "Play with produces/consumes and media-types in general."
},
"host": "localhost:3000",
"schemes": ["http"],
"paths": {
"/mediatypes/analyze": {
"post": {
"description": "Analyze body, that could be different media types.",
"operationId": "AnalyzeBody",
"consumes": ["application/pdf", "application/json", "image/jpeg", "image/png", "image/tiff"],
"produces": ["application/json"],
"parameters": [
{
"$ref": "#/parameters/Input"
}
],
"responses": {
"200": {
"description": "Received correct format",
"schema": {
"type": "string"
}
}
}
}
},
"/mediatypes/analyzeNoAccept": {
"post": {
"description": "Analyze body, that could be different media types. Adds to AnalyzeBody by not having an accept type.",
"operationId": "AnalyzeBodyNoAcceptHeader",
"consumes": ["application/pdf", "application/json", "image/jpeg", "image/png", "image/tiff"],
"parameters": [
{
"$ref": "#/parameters/Input"
}
],
"responses": {
"202": {
"description": "Success"
},
"default": {
"description": "Error response"
}
}
}
},
"/mediatypes/contentTypeWithEncoding": {
"post": {
"description": "Pass in contentType 'text/plain; charset=UTF-8' to pass test. Value for input does not matter",
"operationId": "contentTypeWithEncoding",
"consumes": ["text/plain; charset=UTF-8"],
"produces": ["application/json"],
"parameters": [
{
"name": "input",
"description": "Input parameter.",
"in": "body",
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Received 'text/plain; charset=UTF-8' as contentType",
"schema": {
"type": "string"
}
}
}
}
},
"/mediatypes/binaryBodyTwoContentTypes": {
"post": {
"description": "Binary body with two content types. Pass in of {'hello': 'world'} for the application/json content type, and a byte stream of 'hello, world!' for application/octet-stream.",
"operationId": "binaryBodyWithTwoContentTypes",
"consumes": ["application/octet-stream", "application/json"],
"produces": ["text/plain"],
"parameters": [
{
"in": "body",
"name": "message",
"description": "The payload body.",
"required": true,
"schema": {
"format": "binary",
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Received correct content type and body.",
"schema": {
"type": "string"
}
}
}
}
},
"/mediatypes/binaryBodyThreeContentTypes": {
"post": {
"description": "Binary body with three content types. Pass in string 'hello, world' with content type 'text/plain', {'hello': world'} with content type 'application/json' and a byte string for 'application/octet-stream'.",
"operationId": "binaryBodyWithThreeContentTypes",
"consumes": ["application/octet-stream", "text/plain", "application/json"],
"produces": ["text/plain"],
"parameters": [
{
"in": "body",
"name": "message",
"description": "The payload body.",
"required": true,
"schema": {
"format": "binary",
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Received correct content type and body.",
"schema": {
"type": "string"
}
}
}
}
},
"/mediatypes/bodyThreeTypes": {
"post": {
"description": "Body with three types. Can be stream, string, or JSON. Pass in string 'hello, world' with content type 'text/plain', {'hello': world'} with content type 'application/json' and a byte string for 'application/octet-stream'.",
"operationId": "bodyThreeTypes",
"consumes": ["application/octet-stream", "text/plain", "application/json"],
"produces": ["text/plain"],
"parameters": [
{
"in": "body",
"name": "message",
"description": "The payload body.",
"required": true,
"schema": {}
}
],
"responses": {
"200": {
"description": "Received correct content type and body.",
"schema": {
"type": "string"
}
}
}
}
},
"/mediatypes/textAndJson": {
"post": {
"description": "Body that's either text/plain or application/json",
"operationId": "putTextAndJsonBody",
"consumes": ["text/plain", "application/json"],
"produces": ["text/plain"],
"parameters": [
{
"in": "body",
"name": "message",
"description": "The payload body.",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Received correct content type and body.",
"schema": {
"type": "string"
}
}
}
}
}
},
"definitions": {
"SourcePath": {
"description": "Uri or local path to source data.",
"type": "object",
"properties": {
"source": {
"description": "File source path.",
"maxLength": 2048,
"minLength": 0,
"type": "string"
}
}
}
},
"parameters": {
"Input": {
"name": "input",
"description": "Input parameter.",
"x-ms-parameter-location": "method",
"in": "body",
"schema": {
"$ref": "#/definitions/SourcePath"
}
}
}
}