diff --git a/spring-rest-http/src/main/java/com/baeldung/jsonparam/jsonParamOpenApiSwagger3Definition b/spring-rest-http/src/main/java/com/baeldung/jsonparam/jsonParamOpenApiSwagger3Definition deleted file mode 100644 index 218e24b12b..0000000000 --- a/spring-rest-http/src/main/java/com/baeldung/jsonparam/jsonParamOpenApiSwagger3Definition +++ /dev/null @@ -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 diff --git a/spring-rest-http/src/main/java/com/baeldung/jsonparam/jsonParamOpenApiSwaggerDefinition b/spring-rest-http/src/main/java/com/baeldung/jsonparam/jsonParamOpenApiSwaggerDefinition deleted file mode 100644 index 3261736e15..0000000000 --- a/spring-rest-http/src/main/java/com/baeldung/jsonparam/jsonParamOpenApiSwaggerDefinition +++ /dev/null @@ -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 - } - } diff --git a/spring-rest-http/src/main/resources/openapi-queryparam-definitions/openapi-2.json b/spring-rest-http/src/main/resources/openapi-queryparam-definitions/openapi-2.json new file mode 100644 index 0000000000..53272c9cdb --- /dev/null +++ b/spring-rest-http/src/main/resources/openapi-queryparam-definitions/openapi-2.json @@ -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" diff --git a/spring-rest-http/src/main/resources/openapi-queryparam-definitions/openapi-3.json b/spring-rest-http/src/main/resources/openapi-queryparam-definitions/openapi-3.json new file mode 100644 index 0000000000..a0ed147b9d --- /dev/null +++ b/spring-rest-http/src/main/resources/openapi-queryparam-definitions/openapi-3.json @@ -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