Merge pull request #9093 from alex07pep/BAEL-3896_JSON_Params

BAEL-3896: OpenAPI JSON Objects in Query Params
This commit is contained in:
Josh Cummings 2020-06-03 23:01:08 -06:00 committed by GitHub
commit a6f306f8ce
2 changed files with 112 additions and 0 deletions

View File

@ -0,0 +1,75 @@
swagger: "2.0"
info:
description: "This is a sample server."
version: "1.0.0"
title: "Sample API to send JSON objects as query parameters using OpenAPI 2"
tags:
- name: "tickets"
description: "Send Tickets as JSON Objects"
schemes:
- "https"
- "http"
paths:
/tickets:
get:
tags:
- "tickets"
summary: "Send an JSON Object as a query param"
parameters:
- name: "params"
in: "path"
description: "{\"type\":\"foo\",\"color\":\"green\"}"
required: true
type: "string"
responses:
"200":
description: "Successful operation"
"401":
description: "Unauthorized"
"403":
description: "Forbidden"
"404":
description: "Not found"
post:
tags:
- "tickets"
summary: "Send an JSON Object in body"
parameters:
- name: "params"
in: "body"
description: "Parameter is an JSON object with the `type` and `color` properties that should be serialized as JSON {\"type\":\"foo\",\"color\":\"green\"}"
required: true
schema:
type: string
responses:
"200":
description: "Successful operation"
"401":
description: "Unauthorized"
"403":
description: "Forbidden"
"404":
description: "Not found"
"405":
description: "Invalid input"
/tickets2:
get:
tags:
- "tickets"
summary: "Send an JSON Object in body of get reqest"
parameters:
- name: "params"
in: "body"
description: "Parameter is an JSON object with the `type` and `color` properties that should be serialized as JSON {\"type\":\"foo\",\"color\":\"green\"}"
required: true
schema:
type: string
responses:
"200":
description: "Successful operation"
"401":
description: "Unauthorized"
"403":
description: "Forbidden"
"404":
description: "Not found"

View File

@ -0,0 +1,37 @@
openapi: 3.0.1
info:
title: Sample API to send JSON objects as query parameters using OpenAPI 3
description: This is a sample server.
version: 1.0.0
servers:
- url: /api
tags:
- name: tickets
description: Send Tickets as JSON Objects
paths:
/tickets:
get:
tags:
- tickets
summary: Send an JSON Object as a query param
parameters:
- name: params
in: query
description: '{"type":"foo","color":"green"}'
required: true
schema:
type: object
properties:
type:
type: "string"
color:
type: "string"
responses:
200:
description: Successful operation
401:
description: Unauthorized
403:
description: Forbidden
404:
description: Not found