Quellcode durchsuchen

OAS for simple_get_query done

pinna vor 6 Monaten
Ursprung
Commit
02e7cb8d20
2 geänderte Dateien mit 129 neuen und 102 gelöschten Zeilen
  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
-    info:
-      title: TIGRO
-      description: Explore occurrences, co-occurrences and textual contexts of forms and lems in a corpus which is defined externally.
-      version: 1.0.0
-    servers:
-      - url: 'http://192.168.10.245'
-    paths:
-      /simple_get_query:
-        post:
-          summary: Submit a simple query.
-          description: Submit a simple query in a simple way.
-
-          requestBody:
-            required: true
-            content:
-              application/json:
-                schema:
-                  type: object
-                  properties:
-                    queryList:
-                      type: array
-                      items:
-                        type: object
-                        properties:
-                          stringa:
-                            type: string
-                          espansa:
-                            type: integer
-                          raddoppiata:
-                            type: integer
-                          tipo:
-                            type: string
-          responses:
-            '200':
-              description: OK
-              content:
-                application/json:
-                  schema:
-                    type: array
-                    items:
-                      type: object
-                      properties:
-                        cod:
-                          type: integer
-                        forma:
-                          type: string
-                        lemma:
-                          type: string
-                        cat_gr:
-                          type: string
-                        disambiguatore:
-                          type: string
-                        occ:
-                          type: integer
-            '400':
-              description: Bad request
-            '500':
-              description: Internal server error
-    components:
-      schemas:
-        Query:
-          type: object
-          properties:
-            cod:
-              type: integer
-            forma:
-              type: string
-            lemma:
-              type: string
-            cat_gr:
-              type: string
-            disambiguatore:
-              type: string
-            occ:
-              type: integer
-          required:
-            - cod
-            - occ
+openapi: 3.0.1
+info:
+  title: TIGRO
+  description: Explore occurrences, co-occurrences and textual contexts of forms and lems in a corpus which is defined externally.
+  version: 1.0.0
+servers:
+  - url: 'http://192.168.10.245'
+paths:
+  /simple_get_query:
+    post:
+      summary: Submit a simple query.
+      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:
+        required: true
+        content:
+          application/json:
+            schema:
+              type: object
+              properties:
+                queryList:
+                  type: array
+                  items:
+                    type: object
+                    properties:
+                      stringa:
+                        type: string
+                      espansa:
+                        type: integer
+                        enum:
+                          - 0
+                          - 1
+                      raddoppiata:
+                        type: integer
+                        enum:
+                          - 0
+                          - 1
+                      tipo:
+                        type: string
+                        enum:
+                          - "forma"
+                          - "lemma"
+                          - "lemmaForma"
+                          - "formLemma"
+      responses:
+        '200':
+          description: OK
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/SimpleGetQueryArray'
+        '400':
+          description: Bad request
+        '500':
+          description: Internal server error
+components:
+  schemas:
+    SimpleGetQueryArray:
+      type: array
+      items:
+        oneOf:
+          - $ref: '#/components/schemas/Resp1'
+          - $ref: '#/components/schemas/Resp2'
+          - $ref: '#/components/schemas/Resp3'
+#          - $ref: '#/components/schemas/Resp4' da inserire quando avremo la risposta di 'get_context'
+#    GetContextArray:
+#      type: array
+#      items:
+#        $ref: '#/components/schemas/Resp4'
+    Resp1:
+      type: object
+      properties:
+        cod:
+          type: integer
+        forma:
+          type: string
+        occ:
+          type: integer
+    Resp2:
+      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:
     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:
       type: object
       properties:
@@ -17,28 +17,28 @@
       type: array
       items:
         oneOf:
-          type: object
-          properties:
-            cod: integer
-            forma: string
-            occ: integer
-          type: object
-          properties:
-            cat_gr: "controlled vocabulary"
-            cod: integer
-            disambiguatore: string
-            lemma: string
-            occ: integer
-          type: object
-          properties:
-            cat_gr: "controlled vocabulary"
-            cod: integer
-            disambiguatore: string
-            forma: string
-            lemma: string
-            occ: integer
-          type: object
-          properties: "see 'get_context' output"
+          - type: object
+            properties:
+              cod: integer
+              forma: string
+              occ: integer
+          - type: object
+            properties:
+              cat_gr: "controlled vocabulary"
+              cod: integer
+              disambiguatore: string
+              lemma: string
+              occ: integer
+          - type: object
+            properties:
+              cat_gr: "controlled vocabulary"
+              cod: integer
+              disambiguatore: string
+              forma: string
+              lemma: string
+              occ: integer
+          - type: object
+            properties: "see 'get_context' output"
     splittable: MAYBE
 
 - /get_context: