BAEL-3896: OpenAPI JSON Objects in Query Params - README file revert + required changes

This commit is contained in:
alex.peptan 2020-05-23 20:06:43 +03:00
parent 5b0097f698
commit 59afec1c00
3 changed files with 179 additions and 130 deletions

View File

@ -13,4 +13,3 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring
- [Spring RequestMapping](https://www.baeldung.com/spring-requestmapping)
- [Guide to DeferredResult in Spring](https://www.baeldung.com/spring-deferred-result)
- [Using JSON Patch in Spring REST APIs](https://www.baeldung.com/spring-rest-json-patch)
- [OpenAPI JSON Objects in Query Params](https://www.baeldung.com/openapi-json-objects-in-query-params)

View File

@ -0,0 +1,32 @@
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,5 +1,9 @@
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:
@ -10,10 +14,16 @@ paths:
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
swagger: '2.0'
...
paths:
/tickets:
post:
requestBody:
@ -26,129 +36,137 @@ paths:
responses:
'200':
description: successful process
'201':
description: Created
'401':
description: Unauthorized
'403':
description: Forbidden
'404':
description: Not Found
"/api/tickets": {
"get": {
"tags": [
/api/tickets: {
get: {
tags: [
"account-resource"
],
"summary": "testQueryParamApi",
"operationId": "testQueryParamApiUsingGET",
"produces": [
summary: "testQueryParamApi",
operationId: "testQueryParamApiUsingGET",
produces: [
"*/*"
],
"parameters": [
parameters: [
{
"name": "params",
"in": "query",
"description": "params",
"required": true,
"type": "string"
name: "params",
in: "query",
description: "params",
required: true,
type: "string"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "string"
responses: {
200: {
description: "OK",
schema: {
type: "string"
}
},
"401": {
"description": "Unauthorized"
401: {
description: "Unauthorized"
},
"403": {
"description": "Forbidden"
403: {
description: "Forbidden"
},
"404": {
"description": "Not Found"
404: {
description: "Not Found"
}
},
"deprecated": false
deprecated: false
},
"post": {
"tags": [
post: {
tags: [
"account-resource"
],
"summary": "testBodyParamApi",
"operationId": "testBodyParamApiUsingPOST",
"consumes": [
summary: "testBodyParamApi",
operationId: "testBodyParamApiUsingPOST",
consumes: [
"application/json"
],
"produces": [
produces: [
"*/*"
],
"parameters": [
parameters: [
{
"in": "body",
"name": "params",
"description": "params",
"required": true,
"schema": {
"type": "string"
in: "body",
name: "params",
description: "params",
required: true,
schema: {
type: "string"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "string"
responses: {
200: {
description: "OK",
schema: {
type: "string"
}
},
"201": {
"description": "Created"
201: {
description: "Created"
},
"401": {
"description": "Unauthorized"
401: {
description: "Unauthorized"
},
"403": {
"description": "Forbidden"
403: {
description: "Forbidden"
},
"404": {
"description": "Not Found"
404: {
description: "Not Found"
}
},
"deprecated": false
deprecated: false
}
},
"/api/tickets2": {
"get": {
"tags": [
},
/api/tickets2: {
get: {
tags: [
"account-resource"
],
"summary": "testGetBodyParamApi",
"operationId": "testGetBodyParamApiUsingGET",
"produces": [
summary: "testGetBodyParamApi",
operationId: "testGetBodyParamApiUsingGET",
produces: [
"*/*"
],
"parameters": [
parameters: [
{
"in": "body",
"name": "params",
"description": "params",
"required": true,
"schema": {
"type": "string"
in: "body",
name: "params",
description: "params",
required: true,
schema: {
type: "string"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "string"
responses: {
200: {
description: "OK",
schema: {
type: "string"
}
},
"401": {
"description": "Unauthorized"
401: {
description: "Unauthorized"
},
"403": {
"description": "Forbidden"
403: {
description: "Forbidden"
},
"404": {
"description": "Not Found"
404: {
description: "Not Found"
}
},
"deprecated": false
deprecated: false
}
}
}