Browse Source

OAS for simple_get_query done

pinna 10 months ago
parent
commit
02e7cb8d20
2 changed files with 129 additions and 102 deletions
  1. 106 79
      flask_be/OpenAPI/tigrOAS.yaml
  2. 23 23
      flask_be/doc/endpoints.yaml

+ 106 - 79
flask_be/OpenAPI/tigrOAS.yaml

@@ -1,79 +1,106 @@
-    openapi: 3.0.1
+openapi: 3.0.1
-    info:
+info:
-      title: TIGRO
+  title: TIGRO
-      description: Explore occurrences, co-occurrences and textual contexts of forms and lems in a corpus which is defined externally.
+  description: Explore occurrences, co-occurrences and textual contexts of forms and lems in a corpus which is defined externally.
-      version: 1.0.0
+  version: 1.0.0
-    servers:
+servers:
-      - url: 'http://192.168.10.245'
+  - url: 'http://192.168.10.245'
-    paths:
+paths:
-      /simple_get_query:
+  /simple_get_query:
-        post:
+    post:
-          summary: Submit a simple query.
+      summary: Submit a simple query.
-          description: Submit a simple query in a simple way.
+      description: Cerca 1. occorrenze forme e/o lemmi con opzioni; 2. cooccorrenze di 2+ forme e/o lemmi restituendo direttamente anche i loro contesti.
-
+      requestBody:
-          requestBody:
+        required: true
-            required: true
+        content:
-            content:
+          application/json:
-              application/json:
+            schema:
-                schema:
+              type: object
-                  type: object
+              properties:
-                  properties:
+                queryList:
-                    queryList:
+                  type: array
-                      type: array
+                  items:
-                      items:
+                    type: object
-                        type: object
+                    properties:
-                        properties:
+                      stringa:
-                          stringa:
+                        type: string
-                            type: string
+                      espansa:
-                          espansa:
+                        type: integer
-                            type: integer
+                        enum:
-                          raddoppiata:
+                          - 0
-                            type: integer
+                          - 1
-                          tipo:
+                      raddoppiata:
-                            type: string
+                        type: integer
-          responses:
+                        enum:
-            '200':
+                          - 0
-              description: OK
+                          - 1
-              content:
+                      tipo:
-                application/json:
+                        type: string
-                  schema:
+                        enum:
-                    type: array
+                          - "forma"
-                    items:
+                          - "lemma"
-                      type: object
+                          - "lemmaForma"
-                      properties:
+                          - "formLemma"
-                        cod:
+      responses:
-                          type: integer
+        '200':
-                        forma:
+          description: OK
-                          type: string
+          content:
-                        lemma:
+            application/json:
-                          type: string
+              schema:
-                        cat_gr:
+                $ref: '#/components/schemas/SimpleGetQueryArray'
-                          type: string
+        '400':
-                        disambiguatore:
+          description: Bad request
-                          type: string
+        '500':
-                        occ:
+          description: Internal server error
-                          type: integer
+components:
-            '400':
+  schemas:
-              description: Bad request
+    SimpleGetQueryArray:
-            '500':
+      type: array
-              description: Internal server error
+      items:
-    components:
+        oneOf:
-      schemas:
+          - $ref: '#/components/schemas/Resp1'
-        Query:
+          - $ref: '#/components/schemas/Resp2'
-          type: object
+          - $ref: '#/components/schemas/Resp3'
-          properties:
+#          - $ref: '#/components/schemas/Resp4' da inserire quando avremo la risposta di 'get_context'
-            cod:
+#    GetContextArray:
-              type: integer
+#      type: array
-            forma:
+#      items:
-              type: string
+#        $ref: '#/components/schemas/Resp4'
-            lemma:
+    Resp1:
-              type: string
+      type: object
-            cat_gr:
+      properties:
-              type: string
+        cod:
-            disambiguatore:
+          type: integer
-              type: string
+        forma:
-            occ:
+          type: string
-              type: integer
+        occ:
-          required:
+          type: integer
-            - cod
+    Resp2:
-            - occ
+      type: object
+      properties:
+        lemma:
+          type: string
+        cat_gr:
+          type: string
+        disambiguatore:
+          type: string
+        cod:
+          type: integer
+        occ:
+          type: integer
+    Resp3:
+      type: object
+      properties:
+        lemma:
+          type: string
+        cat_gr:
+          type: string
+        disambiguatore:
+          type: string
+        cod:
+          type: integer
+        occ:
+          type: integer
+        forma:
+          type: string
+#    Resp4 la risposta di 'get_context

+ 23 - 23
flask_be/doc/endpoints.yaml

@@ -1,6 +1,6 @@
 - /simple_get_query:
 - /simple_get_query:
     method: 'POST'
     method: 'POST'
-    description: Cerca: "1. occorrenze forme e/o lemmi con opzioni; 2. cooccorrenze di 2+ forme e/o lemmi restituendo direttamente anche i loro contesti."
+    description: "Cerca: 1. occorrenze forme e/o lemmi con opzioni; 2. cooccorrenze di 2+ forme e/o lemmi restituendo direttamente anche i loro contesti."
     input:
     input:
       type: object
       type: object
       properties:
       properties:
@@ -17,28 +17,28 @@
       type: array
       type: array
       items:
       items:
         oneOf:
         oneOf:
-          type: object
+          - type: object
-          properties:
+            properties:
-            cod: integer
+              cod: integer
-            forma: string
+              forma: string
-            occ: integer
+              occ: integer
-          type: object
+          - type: object
-          properties:
+            properties:
-            cat_gr: "controlled vocabulary"
+              cat_gr: "controlled vocabulary"
-            cod: integer
+              cod: integer
-            disambiguatore: string
+              disambiguatore: string
-            lemma: string
+              lemma: string
-            occ: integer
+              occ: integer
-          type: object
+          - type: object
-          properties:
+            properties:
-            cat_gr: "controlled vocabulary"
+              cat_gr: "controlled vocabulary"
-            cod: integer
+              cod: integer
-            disambiguatore: string
+              disambiguatore: string
-            forma: string
+              forma: string
-            lemma: string
+              lemma: string
-            occ: integer
+              occ: integer
-          type: object
+          - type: object
-          properties: "see 'get_context' output"
+            properties: "see 'get_context' output"
     splittable: MAYBE
     splittable: MAYBE
 
 
 - /get_context:
 - /get_context: