BAEL-3896: OpenAPI JSON Objects in Query Params - swagger definitions moved in resources

This commit is contained in:
alex.peptan 2020-05-27 11:57:14 +03:00
parent 59afec1c00
commit 18d00eae62
4 changed files with 112 additions and 204 deletions

View File

@ -1,32 +0,0 @@
swagger: '3.0'
info:
title: Sample API to send JSON objects as query parameters using OpenAPI 3
description: API description.
version: 1.0.0
paths:
/tickets:
get:
parameters:
- in: query
name: params
required: true
# Parameter is an object that should be serialized as JSON
content:
application/json:
schema:
type: object
properties:
type:
type: string
name:
color: string
responses:
'200':
description: successful process
'401':
description: Unauthorized
'403':
description: Forbidden
'404':
description: Not Found

View File

@ -1,172 +0,0 @@
swagger: '2.0'
info:
title: Sample API to send JSON objects as query parameters using OpenAPI 2
description: API description.
version: 1.0.0
paths:
/tickets:
get:
parameters:
- in: query
name: params
required: true
description: A JSON object with the `type` and `color` properties
type: string
example: '{"type":"foo","color":"green"}'
responses:
'200':
description: successful process
'401':
description: Unauthorized
'403':
description: Forbidden
'404':
description: Not Found
/tickets:
post:
requestBody:
description: Parameter is an object that should be serialized as JSON
content:
application/json:
schema:
type: string
example: '{"type":"foo","color":"green"}'
responses:
'200':
description: successful process
'201':
description: Created
'401':
description: Unauthorized
'403':
description: Forbidden
'404':
description: Not Found
/api/tickets: {
get: {
tags: [
"account-resource"
],
summary: "testQueryParamApi",
operationId: "testQueryParamApiUsingGET",
produces: [
"*/*"
],
parameters: [
{
name: "params",
in: "query",
description: "params",
required: true,
type: "string"
}
],
responses: {
200: {
description: "OK",
schema: {
type: "string"
}
},
401: {
description: "Unauthorized"
},
403: {
description: "Forbidden"
},
404: {
description: "Not Found"
}
},
deprecated: false
},
post: {
tags: [
"account-resource"
],
summary: "testBodyParamApi",
operationId: "testBodyParamApiUsingPOST",
consumes: [
"application/json"
],
produces: [
"*/*"
],
parameters: [
{
in: "body",
name: "params",
description: "params",
required: true,
schema: {
type: "string"
}
}
],
responses: {
200: {
description: "OK",
schema: {
type: "string"
}
},
201: {
description: "Created"
},
401: {
description: "Unauthorized"
},
403: {
description: "Forbidden"
},
404: {
description: "Not Found"
}
},
deprecated: false
}
},
/api/tickets2: {
get: {
tags: [
"account-resource"
],
summary: "testGetBodyParamApi",
operationId: "testGetBodyParamApiUsingGET",
produces: [
"*/*"
],
parameters: [
{
in: "body",
name: "params",
description: "params",
required: true,
schema: {
type: "string"
}
}
],
responses: {
200: {
description: "OK",
schema: {
type: "string"
}
},
401: {
description: "Unauthorized"
},
403: {
description: "Forbidden"
},
404: {
description: "Not Found"
}
},
deprecated: false
}
}

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