From fd95d7e84546c240c73abcf1fbca0a3b88da0685 Mon Sep 17 00:00:00 2001 From: Adam Bem Date: Thu, 2 Mar 2023 14:08:39 +0100 Subject: [PATCH] Added missing docs and organized sample files (#97) Co-authored-by: Adam Bem Reviewed-on: https://gitea.release11.com/R11/release11-tools-web/pulls/97 --- SampleData/functions20 | 129 ---------- SampleData/sample_xml.xml | 33 --- SampleData/transform.xslt | 9 - .../sample => Samples}/minimize/minimize.curl | 0 .../sample => Samples}/minimize/minimize.json | 0 .../sample => Samples}/minimize/pretty | 0 .../sample => Samples}/prettify/prettify.curl | 0 .../sample => Samples}/prettify/prettify.json | 0 {SampleData => Samples/xpath}/book.xml | 0 {SampleData => Samples/xpath}/bookNS.xml | 0 .../sample => Samples}/xpath/data.json | 0 .../sample => Samples}/xpath/dataNS.json | 0 .../sample => Samples}/xpath/non-ns.curl | 0 .../sample => Samples}/xpath/ns.curl | 0 Samples/xsd/sample.xml | 5 + Samples/xsd/schema.xsd | 10 + .../sample => Samples}/xsd/xsd.curl | 0 .../sample => Samples}/xsd/xsd.json | 0 .../xslt/sampleXML.xml | 0 Samples/xslt/sampleXSLT.xslt | 12 + .../sample => Samples}/xslt/xslt.curl | 0 .../sample => Samples}/xslt/xslt.json | 0 Swagger/swagger.json | 234 +++++++++++++++++- 23 files changed, 248 insertions(+), 184 deletions(-) delete mode 100644 SampleData/functions20 delete mode 100644 SampleData/sample_xml.xml delete mode 100644 SampleData/transform.xslt rename {Backend-libXML/sample => Samples}/minimize/minimize.curl (100%) rename {Backend-libXML/sample => Samples}/minimize/minimize.json (100%) rename {Backend-libXML/sample => Samples}/minimize/pretty (100%) rename {Backend-libXML/sample => Samples}/prettify/prettify.curl (100%) rename {Backend-libXML/sample => Samples}/prettify/prettify.json (100%) rename {SampleData => Samples/xpath}/book.xml (100%) rename {SampleData => Samples/xpath}/bookNS.xml (100%) rename {Backend-libXML/sample => Samples}/xpath/data.json (100%) rename {Backend-libXML/sample => Samples}/xpath/dataNS.json (100%) rename {Backend-libXML/sample => Samples}/xpath/non-ns.curl (100%) rename {Backend-libXML/sample => Samples}/xpath/ns.curl (100%) create mode 100644 Samples/xsd/sample.xml create mode 100644 Samples/xsd/schema.xsd rename {Backend-libXML/sample => Samples}/xsd/xsd.curl (100%) rename {Backend-libXML/sample => Samples}/xsd/xsd.json (100%) rename SampleData/sampleXML.xslt => Samples/xslt/sampleXML.xml (100%) create mode 100644 Samples/xslt/sampleXSLT.xslt rename {Backend-libXML/sample => Samples}/xslt/xslt.curl (100%) rename {Backend-libXML/sample => Samples}/xslt/xslt.json (100%) diff --git a/SampleData/functions20 b/SampleData/functions20 deleted file mode 100644 index 3cd39d2..0000000 --- a/SampleData/functions20 +++ /dev/null @@ -1,129 +0,0 @@ -abs( -adjust-dateTime-to-timezone( -adjust-date-to-timezone( -adjust-time-to-timezone( -avg( -base-uri( -boolean( -ceiling( -codepoints-to-string( -collection( -compare( -concat( -contains( -context-item( -count( -current( -current-date( -current-dateTime( -current-group( -current-grouping-key( -current-time( -data( -day-from-date( -day-from-dateTime( -days-from-dayTimeDuration( -deep-equal( -default-collation( -distinct-nodes( -distinct-values( -doc( -document( -document-uri( -element-available( -empty( -ends-with( -error( -escape-uri( -exactly-one( -exists( -expanded-QName( -false( -floor( -format-date( -format-dateTime( -format-number( -format-time( -function-available( -generate-id( -hours-from-dateTime( -hours-from-dayTimeDuration( -hours-from-time( -id( -idref( -implicit-timezone( -index-of( -input( -in-scope-prefixes( -insert-before( -item-at( -key( -lang( -last( -local-name( -local-name-from-QName( -lower-case( -matches( -max( -min( -minutes-from-dateTime( -minutes-from-dayTimeDuration( -minutes-from-time( -month-from-date( -month-from-dateTime( -months-from-yearMonthDuration( -name( -namespace-uri( -namespace-uri-for-prefix( -namespace-uri-from-QName( -node-kind( -node-name( -normalize-space( -normalize-unicode( -not( -number( -one-or-more( -position( -regex-group( -remove( -replace( -resolve-QName( -resolve-uri( -reverse( -root( -round( -round-half-to-even( -seconds-from-dateTime( -seconds-from-dayTimeDuration( -seconds-from-time( -sequence-node-identical( -starts-with( -string( -string-join( -string-length( -string-pad( -string-to-codepoints( -subsequence( -substring( -substring-after( -substring-before( -subtract-dateTimes-yielding-dayTimeDuration( -subtract-dateTimes-yielding-yearMonthDuration( -sum( -system-property( -timezone-from-date( -timezone-from-dateTime( -timezone-from-time( -tokenize( -trace( -translate( -true( -unordered( -unparsed-entity-public-id( -unparsed-entity-uri( -unparsed-text( -upper-case( -year-from-date( -year-from-dateTime( -years-from-yearMonthDuration( -zero-or-one( diff --git a/SampleData/sample_xml.xml b/SampleData/sample_xml.xml deleted file mode 100644 index cd89168..0000000 --- a/SampleData/sample_xml.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - City library - 345123 - - - 7321 - Adam - Choke - - - 5123 - Lauren - Wong - - - - - 6422 - Harry Potter - 7542 - - - 1234 - Macbeth - 5123 - - - 9556 - Romeo and Juliet - - - \ No newline at end of file diff --git a/SampleData/transform.xslt b/SampleData/transform.xslt deleted file mode 100644 index df9590a..0000000 --- a/SampleData/transform.xslt +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/Backend-libXML/sample/minimize/minimize.curl b/Samples/minimize/minimize.curl similarity index 100% rename from Backend-libXML/sample/minimize/minimize.curl rename to Samples/minimize/minimize.curl diff --git a/Backend-libXML/sample/minimize/minimize.json b/Samples/minimize/minimize.json similarity index 100% rename from Backend-libXML/sample/minimize/minimize.json rename to Samples/minimize/minimize.json diff --git a/Backend-libXML/sample/minimize/pretty b/Samples/minimize/pretty similarity index 100% rename from Backend-libXML/sample/minimize/pretty rename to Samples/minimize/pretty diff --git a/Backend-libXML/sample/prettify/prettify.curl b/Samples/prettify/prettify.curl similarity index 100% rename from Backend-libXML/sample/prettify/prettify.curl rename to Samples/prettify/prettify.curl diff --git a/Backend-libXML/sample/prettify/prettify.json b/Samples/prettify/prettify.json similarity index 100% rename from Backend-libXML/sample/prettify/prettify.json rename to Samples/prettify/prettify.json diff --git a/SampleData/book.xml b/Samples/xpath/book.xml similarity index 100% rename from SampleData/book.xml rename to Samples/xpath/book.xml diff --git a/SampleData/bookNS.xml b/Samples/xpath/bookNS.xml similarity index 100% rename from SampleData/bookNS.xml rename to Samples/xpath/bookNS.xml diff --git a/Backend-libXML/sample/xpath/data.json b/Samples/xpath/data.json similarity index 100% rename from Backend-libXML/sample/xpath/data.json rename to Samples/xpath/data.json diff --git a/Backend-libXML/sample/xpath/dataNS.json b/Samples/xpath/dataNS.json similarity index 100% rename from Backend-libXML/sample/xpath/dataNS.json rename to Samples/xpath/dataNS.json diff --git a/Backend-libXML/sample/xpath/non-ns.curl b/Samples/xpath/non-ns.curl similarity index 100% rename from Backend-libXML/sample/xpath/non-ns.curl rename to Samples/xpath/non-ns.curl diff --git a/Backend-libXML/sample/xpath/ns.curl b/Samples/xpath/ns.curl similarity index 100% rename from Backend-libXML/sample/xpath/ns.curl rename to Samples/xpath/ns.curl diff --git a/Samples/xsd/sample.xml b/Samples/xsd/sample.xml new file mode 100644 index 0000000..9189811 --- /dev/null +++ b/Samples/xsd/sample.xml @@ -0,0 +1,5 @@ + + + Test + Test3 + diff --git a/Samples/xsd/schema.xsd b/Samples/xsd/schema.xsd new file mode 100644 index 0000000..b36116c --- /dev/null +++ b/Samples/xsd/schema.xsd @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/Backend-libXML/sample/xsd/xsd.curl b/Samples/xsd/xsd.curl similarity index 100% rename from Backend-libXML/sample/xsd/xsd.curl rename to Samples/xsd/xsd.curl diff --git a/Backend-libXML/sample/xsd/xsd.json b/Samples/xsd/xsd.json similarity index 100% rename from Backend-libXML/sample/xsd/xsd.json rename to Samples/xsd/xsd.json diff --git a/SampleData/sampleXML.xslt b/Samples/xslt/sampleXML.xml similarity index 100% rename from SampleData/sampleXML.xslt rename to Samples/xslt/sampleXML.xml diff --git a/Samples/xslt/sampleXSLT.xslt b/Samples/xslt/sampleXSLT.xslt new file mode 100644 index 0000000..178e5a0 --- /dev/null +++ b/Samples/xslt/sampleXSLT.xslt @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/Backend-libXML/sample/xslt/xslt.curl b/Samples/xslt/xslt.curl similarity index 100% rename from Backend-libXML/sample/xslt/xslt.curl rename to Samples/xslt/xslt.curl diff --git a/Backend-libXML/sample/xslt/xslt.json b/Samples/xslt/xslt.json similarity index 100% rename from Backend-libXML/sample/xslt/xslt.json rename to Samples/xslt/xslt.json diff --git a/Swagger/swagger.json b/Swagger/swagger.json index 5732422..e38e77b 100644 --- a/Swagger/swagger.json +++ b/Swagger/swagger.json @@ -30,6 +30,10 @@ { "name": "Mocked services", "description": "Mocked services controller" + }, + { + "name": "XML Formatter", + "description": "XML formatting API" } ], "paths": { @@ -38,7 +42,7 @@ "tags": [ "Mocked events" ], - "summary": "filterHistory", + "summary": "Filter History", "operationId": "filterHistoryUsingPOST", "consumes": [ "application/json" @@ -84,7 +88,7 @@ "tags": [ "Mocked events" ], - "summary": "getLastDay", + "summary": "Get last day", "operationId": "getLastDayUsingGET", "produces": [ "*/*" @@ -131,7 +135,7 @@ "tags": [ "Mocked services" ], - "summary": "updateMessage", + "summary": "Update message", "operationId": "updateMessageUsingPUT", "consumes": [ "application/json" @@ -177,7 +181,7 @@ "tags": [ "Mocked services" ], - "summary": "getListOfMessages", + "summary": "Get list of messages", "operationId": "getListOfMessagesUsingGET", "produces": [ "*/*" @@ -218,7 +222,7 @@ "tags": [ "Mocked services" ], - "summary": "getMockedResponse", + "summary": "Get response from mocked service", "operationId": "getMockedResponseUsingGET", "produces": [ "*/*" @@ -300,7 +304,7 @@ "tags": [ "Mocked services" ], - "summary": "getListOfMessages", + "summary": "Get list of messages", "operationId": "getListOfMessagesUsingGET_1", "produces": [ "*/*" @@ -383,7 +387,7 @@ "tags": [ "Mocked services" ], - "summary": "removeMessage", + "summary": "Remove message", "operationId": "removeMessageUsingDELETE", "produces": [ "*/*" @@ -645,6 +649,100 @@ } } } + }, + "/minimize": { + "post": { + "tags": [ + "XML Formatter" + ], + "summary": "Minimize given XML (only libxml)", + "description": "Removes any unneeded whitespace from given xml file", + "operationId": "minimize", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "in": "body", + "name": "request", + "description": "A XML to minimize", + "required": true, + "schema": { + "$ref": "#/definitions/RequestPrettify" + } + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/MinimizedResponse" + } + } + }, + "400": { + "description": "Invalid status value", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/XSDError" + } + } + } + } + } + }, + "/prettify": { + "post": { + "tags": [ + "XML Formatter" + ], + "summary": "Prettify given XML (only libxml)", + "description": "Removes any unneeded whitespace from given xml file", + "operationId": "minimize", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "in": "body", + "name": "request", + "description": "A XML to prettify", + "required": true, + "schema": { + "$ref": "#/definitions/RequestMinimize" + } + } + ], + "responses": { + "200": { + "description": "Successful operation", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/MinimizedResponse" + } + } + }, + "400": { + "description": "Invalid status value", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/XSDError" + } + } + } + } + } } }, "definitions": { @@ -794,7 +892,7 @@ "properties": { "data": { "type": "string", - "example": " Test1 Test3 ", + "example": "28", "description": "The XML data to be processed" }, "process": { @@ -824,7 +922,7 @@ "properties": { "data": { "type": "string", - "example": " Test1 Test3 ", + "example": "28", "description": "The XML data to be processed" }, "process": { @@ -854,12 +952,12 @@ "properties": { "data": { "type": "string", - "example": " Ola Nordmann Langgt 23 4000 Stavanger Norway ", + "example": "28", "description": "The XML data to be processed" }, "process": { "type": "string", - "example": " Ola Nordmann Langgt 23 4000 Stavanger Norway ", + "example": " ", "description": "XSD to perform verification with" }, "processor": { @@ -896,7 +994,8 @@ "type": "string", "enum": [ "Saxon 10.3 2.0 over s9api", - "Xalan Java 2.7.2" + "Xalan Java 2.7.2", + "libXml over lxml" ] }, "status": { @@ -924,7 +1023,8 @@ "type": "string", "enum": [ "Saxon 10.3 2.0 over s9api", - "Xalan Java 2.7.2" + "Xalan Java 2.7.2", + "libXml over lxml" ] }, "status": { @@ -988,6 +1088,114 @@ ] } } + }, + "RequestPrettify": { + "type": "object", + "properties": { + "data": { + "type": "string", + "example": "28", + "description": "The XML data to be prettified" + }, + "process": { + "type": "string", + "example": "", + "description": "Unused here, required only to use same json for whole project" + }, + "processor": { + "type": "string", + "enum": [ + "libxml" + ] + }, + "version": { + "type": "string", + "enum": [ + "1.0" + ] + } + } + }, + "RequestMinimize": { + "type": "object", + "properties": { + "data": { + "type": "string", + "example": "28", + "description": "The XML data to be minimized" + }, + "process": { + "type": "string", + "example": "", + "description": "Unused here, required only to use same json for whole project" + }, + "processor": { + "type": "string", + "enum": [ + "libxml" + ] + }, + "version": { + "type": "string", + "enum": [ + "1.0" + ] + } + } + }, + "PrettifiedResponse": { + "type": "object", + "properties": { + "result": { + "type": "string", + "example": "\\n\\t2\\n\\t8\\n", + "description": "Prettified XML" + }, + "time": { + "type": "string", + "example": "320", + "description": "Computation time in milliseconds" + }, + "processor": { + "type": "string", + "enum": [ + "libXml over lxml" + ] + }, + "status": { + "type": "string", + "enum": [ + "OK" + ] + } + } + }, + "MinimizedResponse": { + "type": "object", + "properties": { + "result": { + "type": "string", + "example": "28", + "description": "Result of minimized provided XML" + }, + "time": { + "type": "string", + "example": "320", + "description": "Computation time in milliseconds" + }, + "processor": { + "type": "string", + "enum": [ + "libXml over lxml" + ] + }, + "status": { + "type": "string", + "enum": [ + "OK" + ] + } + } } }, "externalDocs": {