Created swagger container and swagger documentation from ./Swagger/swagger.json (#87)

Co-authored-by: Artur Kołecki <koleckiartur@icloud.com>
Reviewed-on: R11/release11-tools-web#87
This commit is contained in:
2023-03-01 11:44:21 +01:00
parent 773e2ac17e
commit dee92f0e3d
5 changed files with 929 additions and 27 deletions

View File

@@ -72,11 +72,6 @@
<artifactId>jettison</artifactId> <artifactId>jettison</artifactId>
<version>1.4.1</version> <version>1.4.1</version>
</dependency> </dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-boot-starter</artifactId>
<version>3.0.0</version>
</dependency>
</dependencies> </dependencies>
<build> <build>

View File

@@ -1,22 +0,0 @@
package com.r11.tools.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
@Configuration
@EnableSwagger2
public class SpringFoxConfig {
@Bean
public Docket api(){
return new Docket(DocumentationType.SWAGGER_2)
.select()
.apis(RequestHandlerSelectors.any())
.paths(PathSelectors.ant("/api/**"))
.build();
}
}

915
Swagger/swagger.json Normal file
View File

@@ -0,0 +1,915 @@
{
"swagger": "2.0",
"info": {
"description": "Web tools api documentation.",
"version": "1.0",
"title": "Release11 Web Tools"
},
"host": "tools.zipper.release11.com",
"schemes": [
"http",
"https"
],
"tags": [
{
"name": "XPath",
"description": "XPath processing API"
},
{
"name": "XSLT",
"description": "XSLT processing API"
},
{
"name": "XSD",
"description": "XSD verification API"
},
{
"name": "Mocked events",
"description": "Mocked events controller"
},
{
"name": "Mocked services",
"description": "Mocked services controller"
}
],
"paths": {
"/api/event": {
"post": {
"tags": [
"Mocked events"
],
"summary": "filterHistory",
"operationId": "filterHistoryUsingPOST",
"consumes": [
"application/json"
],
"produces": [
"*/*"
],
"parameters": [
{
"in": "body",
"name": "event",
"description": "event",
"required": true,
"schema": {
"$ref": "#/definitions/EventRequestDto"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/ResponseEntity"
}
},
"201": {
"description": "Created"
},
"401": {
"description": "Unauthorized"
},
"403": {
"description": "Forbidden"
},
"404": {
"description": "Not Found"
}
}
}
},
"/api/event/{uuid}/{messageId}": {
"get": {
"tags": [
"Mocked events"
],
"summary": "getLastDay",
"operationId": "getLastDayUsingGET",
"produces": [
"*/*"
],
"parameters": [
{
"name": "messageId",
"in": "path",
"description": "messageId",
"required": true,
"type": "integer",
"format": "int32"
},
{
"name": "uuid",
"in": "path",
"description": "uuid",
"required": true,
"type": "string",
"format": "uuid"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/ResponseEntity"
}
},
"401": {
"description": "Unauthorized"
},
"403": {
"description": "Forbidden"
},
"404": {
"description": "Not Found"
}
}
}
},
"/api/mock": {
"put": {
"tags": [
"Mocked services"
],
"summary": "updateMessage",
"operationId": "updateMessageUsingPUT",
"consumes": [
"application/json"
],
"produces": [
"*/*"
],
"parameters": [
{
"in": "body",
"name": "body",
"description": "body",
"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"
}
}
}
},
"/api/mock/": {
"get": {
"tags": [
"Mocked services"
],
"summary": "getListOfMessages",
"operationId": "getListOfMessagesUsingGET",
"produces": [
"*/*"
],
"parameters": [
{
"name": "uuidValue",
"in": "path",
"description": "uuidValue",
"required": true,
"type": "string"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/MockedMessageDto"
}
}
},
"401": {
"description": "Unauthorized"
},
"403": {
"description": "Forbidden"
},
"404": {
"description": "Not Found"
}
}
}
},
"/api/mock/r/{clientUUID}/{mockedResponseId}": {
"get": {
"tags": [
"Mocked services"
],
"summary": "getMockedResponse",
"operationId": "getMockedResponseUsingGET",
"produces": [
"*/*"
],
"parameters": [
{
"name": "body",
"in": "query",
"required": false,
"type": "string"
},
{
"name": "clientUUID",
"in": "path",
"description": "clientUUID",
"required": true,
"type": "string",
"format": "uuid"
},
{
"name": "method",
"in": "query",
"required": false,
"type": "string",
"enum": [
"DELETE",
"GET",
"HEAD",
"OPTIONS",
"PATCH",
"POST",
"PUT",
"TRACE"
]
},
{
"name": "mockedResponseId",
"in": "path",
"description": "mockedResponseId",
"required": true,
"type": "integer",
"format": "int32"
},
{
"name": "type",
"in": "query",
"required": false,
"type": "string"
},
{
"name": "url",
"in": "query",
"required": false,
"type": "string",
"format": "uri"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/ResponseEntity"
}
},
"401": {
"description": "Unauthorized"
},
"403": {
"description": "Forbidden"
},
"404": {
"description": "Not Found"
}
}
}
},
"/api/mock/{uuidValue}": {
"get": {
"tags": [
"Mocked services"
],
"summary": "getListOfMessages",
"operationId": "getListOfMessagesUsingGET_1",
"produces": [
"*/*"
],
"parameters": [
{
"name": "uuidValue",
"in": "path",
"description": "uuidValue",
"required": true,
"type": "string"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/MockedMessageDto"
}
}
},
"401": {
"description": "Unauthorized"
},
"403": {
"description": "Forbidden"
},
"404": {
"description": "Not Found"
}
}
},
"post": {
"tags": [
"Mocked services"
],
"summary": "addNewMessage",
"operationId": "addNewMessageUsingPOST",
"consumes": [
"application/json"
],
"produces": [
"*/*"
],
"parameters": [
{
"name": "uuidValue",
"in": "path",
"description": "uuidValue",
"required": true,
"type": "string"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "string"
}
},
"201": {
"description": "Created"
},
"401": {
"description": "Unauthorized"
},
"403": {
"description": "Forbidden"
},
"404": {
"description": "Not Found"
}
}
}
},
"/api/mock/{uuidValue}/{idValue}": {
"delete": {
"tags": [
"Mocked services"
],
"summary": "removeMessage",
"operationId": "removeMessageUsingDELETE",
"produces": [
"*/*"
],
"parameters": [
{
"name": "idValue",
"in": "path",
"description": "idValue",
"required": true,
"type": "string"
},
{
"name": "uuidValue",
"in": "path",
"description": "uuidValue",
"required": true,
"type": "string"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "string"
}
},
"204": {
"description": "No Content"
},
"401": {
"description": "Unauthorized"
},
"403": {
"description": "Forbidden"
}
}
}
},
"/xpathpost": {
"post": {
"tags": [
"XPath"
],
"summary": "Perform XPath transform on XML file",
"description": "",
"operationId": "xpath",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"parameters": [
{
"in": "body",
"name": "request",
"description": "A transform that is to be performed",
"required": true,
"schema": {
"$ref": "#/definitions/RequestXPath"
}
}
],
"responses": {
"200": {
"description": "successful operation",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/Response"
}
}
},
"400": {
"description": "Invalid status value",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/ResponseError"
}
}
}
}
}
},
"/xsltpost": {
"post": {
"tags": [
"XSLT"
],
"summary": "Perform XSLT transform on XML file",
"description": "",
"operationId": "xslt",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"parameters": [
{
"in": "body",
"name": "request",
"description": "A transform that is to be performed",
"required": true,
"schema": {
"$ref": "#/definitions/RequestXSLT"
}
}
],
"responses": {
"200": {
"description": "successful operation",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/Response"
}
}
},
"400": {
"description": "Invalid status value",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/ResponseError"
}
}
}
}
}
},
"/xsdpost": {
"post": {
"tags": [
"XSD"
],
"summary": "Verify XML file using XSD",
"description": "",
"operationId": "xsd",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"parameters": [
{
"in": "body",
"name": "request",
"description": "A XML that is to be verified",
"required": true,
"schema": {
"$ref": "#/definitions/RequestXSD"
}
}
],
"responses": {
"200": {
"description": "successful operation",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/XSDResponse"
}
}
},
"400": {
"description": "Invalid status value",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/XSDError"
}
}
}
}
}
}
},
"definitions": {
"EventRequestDto": {
"type": "object",
"properties": {
"clientUUID": {
"type": "string",
"format": "uuid"
},
"localDateTimeFrom": {
"type": "string",
"format": "date-time"
},
"localDateTimeTo": {
"type": "string",
"format": "date-time"
},
"mockedResponseId": {
"type": "integer",
"format": "int32"
}
},
"title": "EventRequestDto"
},
"MockedMessageDto": {
"type": "object",
"required": [
"mockedResponseId"
],
"properties": {
"clientUUID": {
"type": "string",
"format": "uuid"
},
"httpHeaders": {
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"httpStatus": {
"type": "integer",
"format": "int32"
},
"mediaType": {
"type": "string"
},
"messageBody": {
"type": "string"
},
"mockedResponseId": {
"type": "integer",
"format": "int32"
}
},
"title": "MockedMessageDto"
},
"ResponseEntity": {
"type": "object",
"properties": {
"body": {
"type": "object"
},
"statusCode": {
"type": "string",
"enum": [
"ACCEPTED",
"ALREADY_REPORTED",
"BAD_GATEWAY",
"BAD_REQUEST",
"BANDWIDTH_LIMIT_EXCEEDED",
"CHECKPOINT",
"CONFLICT",
"CONTINUE",
"CREATED",
"DESTINATION_LOCKED",
"EXPECTATION_FAILED",
"FAILED_DEPENDENCY",
"FORBIDDEN",
"FOUND",
"GATEWAY_TIMEOUT",
"GONE",
"HTTP_VERSION_NOT_SUPPORTED",
"IM_USED",
"INSUFFICIENT_SPACE_ON_RESOURCE",
"INSUFFICIENT_STORAGE",
"INTERNAL_SERVER_ERROR",
"I_AM_A_TEAPOT",
"LENGTH_REQUIRED",
"LOCKED",
"LOOP_DETECTED",
"METHOD_FAILURE",
"METHOD_NOT_ALLOWED",
"MOVED_PERMANENTLY",
"MOVED_TEMPORARILY",
"MULTIPLE_CHOICES",
"MULTI_STATUS",
"NETWORK_AUTHENTICATION_REQUIRED",
"NON_AUTHORITATIVE_INFORMATION",
"NOT_ACCEPTABLE",
"NOT_EXTENDED",
"NOT_FOUND",
"NOT_IMPLEMENTED",
"NOT_MODIFIED",
"NO_CONTENT",
"OK",
"PARTIAL_CONTENT",
"PAYLOAD_TOO_LARGE",
"PAYMENT_REQUIRED",
"PERMANENT_REDIRECT",
"PRECONDITION_FAILED",
"PRECONDITION_REQUIRED",
"PROCESSING",
"PROXY_AUTHENTICATION_REQUIRED",
"REQUESTED_RANGE_NOT_SATISFIABLE",
"REQUEST_ENTITY_TOO_LARGE",
"REQUEST_HEADER_FIELDS_TOO_LARGE",
"REQUEST_TIMEOUT",
"REQUEST_URI_TOO_LONG",
"RESET_CONTENT",
"SEE_OTHER",
"SERVICE_UNAVAILABLE",
"SWITCHING_PROTOCOLS",
"TEMPORARY_REDIRECT",
"TOO_EARLY",
"TOO_MANY_REQUESTS",
"UNAUTHORIZED",
"UNAVAILABLE_FOR_LEGAL_REASONS",
"UNPROCESSABLE_ENTITY",
"UNSUPPORTED_MEDIA_TYPE",
"UPGRADE_REQUIRED",
"URI_TOO_LONG",
"USE_PROXY",
"VARIANT_ALSO_NEGOTIATES"
]
},
"statusCodeValue": {
"type": "integer",
"format": "int32"
}
},
"title": "ResponseEntity"
},
"RequestXPath": {
"type": "object",
"properties": {
"data": {
"type": "string",
"example": " Test1 Test3 ",
"description": "The XML data to be processed"
},
"process": {
"type": "string",
"example": "count(//value)",
"description": "XPath tranform to be executed"
},
"processor": {
"type": "string",
"enum": [
"saxon",
"xalan"
]
},
"version": {
"type": "string",
"enum": [
"2.0",
"3.0",
"3.1"
]
}
}
},
"RequestXSLT": {
"type": "object",
"properties": {
"data": {
"type": "string",
"example": " Test1 Test3 ",
"description": "The XML data to be processed"
},
"process": {
"type": "string",
"example": "count(//value)",
"description": "XSLT tranform to be executed"
},
"processor": {
"type": "string",
"enum": [
"saxon",
"xalan"
]
},
"version": {
"type": "string",
"enum": [
"2.0",
"3.0",
"3.1"
]
}
}
},
"RequestXSD": {
"type": "object",
"properties": {
"data": {
"type": "string",
"example": " Ola Nordmann Langgt 23 4000 Stavanger Norway ",
"description": "The XML data to be processed"
},
"process": {
"type": "string",
"example": " Ola Nordmann Langgt 23 4000 Stavanger Norway ",
"description": "XSD to perform verification with"
},
"processor": {
"type": "string",
"enum": [
"saxon",
"xalan"
]
},
"version": {
"type": "string",
"enum": [
"2.0",
"3.0",
"3.1"
]
}
}
},
"Response": {
"type": "object",
"properties": {
"result": {
"type": "string",
"example": "4",
"description": "Result of performing transformation on provided XML"
},
"time": {
"type": "string",
"example": "320",
"description": "Computation time in milliseconds"
},
"processor": {
"type": "string",
"enum": [
"Saxon 10.3 2.0 over s9api",
"Xalan Java 2.7.2"
]
},
"status": {
"type": "string",
"enum": [
"OK"
]
}
}
},
"ResponseError": {
"type": "object",
"properties": {
"result": {
"type": "string",
"example": "Concatenation operator ('||') requires XPath 3.0 to be enabled",
"description": "Error from XPath processor"
},
"time": {
"type": "string",
"example": "40",
"description": "Computation time in milliseconds"
},
"processor": {
"type": "string",
"enum": [
"Saxon 10.3 2.0 over s9api",
"Xalan Java 2.7.2"
]
},
"status": {
"type": "string",
"enum": [
"ERR"
]
}
}
},
"XSDResponse": {
"type": "object",
"properties": {
"result": {
"type": "string",
"example": "XML file is valid",
"description": "Validation result"
},
"time": {
"type": "string",
"example": "7",
"description": "Computation time in milliseconds"
},
"processor": {
"type": "string",
"enum": [
"Xalan Java 2.7.2"
]
},
"status": {
"type": "string",
"enum": [
"OK"
]
}
}
},
"XSDError": {
"type": "object",
"properties": {
"result": {
"type": "string",
"example": "The end-tag for element type \"xs:complexType\" must end with a '>' delimiter.",
"description": "Validation result"
},
"time": {
"type": "string",
"example": "7",
"description": "Computation time in milliseconds"
},
"processor": {
"type": "string",
"enum": [
"Xalan Java 2.7.2"
]
},
"status": {
"type": "string",
"enum": [
"ERR"
]
}
}
}
},
"externalDocs": {
"description": "Find out more about Swagger",
"url": "http://swagger.io"
}
}

View File

@@ -39,6 +39,17 @@ services:
environment: environment:
SPRING_PROFILES_ACTIVE: DEV SPRING_PROFILES_ACTIVE: DEV
swagger:
image: "swaggerapi/swagger-ui:latest"
container_name: xmltools-swagger
ports:
- "8000:8080"
environment:
- BASE_URL=/swagger
- SWAGGER_JSON=/Swagger/swagger.json
volumes:
- ./Swagger:/Swagger
networks: networks:
default: default:
name: tools_network name: tools_network

View File

@@ -10,6 +10,9 @@ Service is split into three microservices.
Main page is hosted on port 8086. Main page is hosted on port 8086.
## API Documentation
API documentation is available on port 8080/swagger/
## JavaSpark backend ## JavaSpark backend
Backend is hosted by default on port 8081. Rest api documentation is contained in OpenApi document Backend is hosted by default on port 8081. Rest api documentation is contained in OpenApi document
openapi.yml openapi.yml