From f2b88b5bb60402c2141164a04374c5db2841381d Mon Sep 17 00:00:00 2001
From: Erwan Rouchet <rouchet@teklia.com>
Date: Tue, 30 Jul 2019 20:42:58 +0000
Subject: [PATCH] Update schema for ML classes

---
 arkindex/schema.yml | 126 +++++++++-----------------------------------
 1 file changed, 26 insertions(+), 100 deletions(-)

diff --git a/arkindex/schema.yml b/arkindex/schema.yml
index 9fd7822..ee43359 100644
--- a/arkindex/schema.yml
+++ b/arkindex/schema.yml
@@ -229,12 +229,12 @@ paths:
                 classifications:
                   items:
                     properties:
+                      class_name:
+                        type: string
                       confidence:
                         type: number
-                      ml_class:
-                        type: string
                     required:
-                    - ml_class
+                    - class_name
                     - confidence
                   type: array
                 classifier:
@@ -255,12 +255,12 @@ paths:
                   classifications:
                     items:
                       properties:
+                        class_name:
+                          type: string
                         confidence:
                           type: number
-                        ml_class:
-                          type: string
                       required:
-                      - ml_class
+                      - class_name
                       - confidence
                     type: array
                   classifier:
@@ -275,6 +275,8 @@ paths:
       - ml
   /api/v1/classifications/:
     post:
+      description: Manually add a class on a page, as a human, not as a machine learning
+        tool.
       operationId: CreateClassification
       parameters: []
       requestBody:
@@ -303,8 +305,11 @@ paths:
                 required:
                 - page
                 - ml_class
+      tags:
+      - ml
   /api/v1/classifications/{id}/reject/:
     put:
+      description: Reject an existing classification.
       operationId: RejectClassification
       parameters:
       - description: ''
@@ -317,52 +322,7 @@ paths:
         content:
           application/json:
             schema:
-              properties:
-                confidence:
-                  nullable: true
-                  type: number
-                id:
-                  type: string
-                ml_class:
-                  properties:
-                    id:
-                      type: string
-                    name:
-                      type: string
-                  required:
-                  - name
-                  type: object
-                source:
-                  properties:
-                    id:
-                      type: string
-                    internal:
-                      type: boolean
-                    revision:
-                      type: string
-                    slug:
-                      type: string
-                    type:
-                      enum:
-                      - classifier
-                      - recognizer
-                      - ner
-                      - dla
-                  required:
-                  - type
-                  - slug
-                  - revision
-                  - internal
-                  type: object
-                state:
-                  enum:
-                  - pending
-                  - validated
-                  - rejected
-              required:
-              - source
-              - ml_class
-              - state
+              properties: {}
         x-name: body
       responses:
         '200':
@@ -415,8 +375,11 @@ paths:
                 - source
                 - ml_class
                 - state
+      tags:
+      - ml
   /api/v1/classifications/{id}/validate/:
     put:
+      description: Validate an existing classification.
       operationId: ValidateClassification
       parameters:
       - description: ''
@@ -429,52 +392,7 @@ paths:
         content:
           application/json:
             schema:
-              properties:
-                confidence:
-                  nullable: true
-                  type: number
-                id:
-                  type: string
-                ml_class:
-                  properties:
-                    id:
-                      type: string
-                    name:
-                      type: string
-                  required:
-                  - name
-                  type: object
-                source:
-                  properties:
-                    id:
-                      type: string
-                    internal:
-                      type: boolean
-                    revision:
-                      type: string
-                    slug:
-                      type: string
-                    type:
-                      enum:
-                      - classifier
-                      - recognizer
-                      - ner
-                      - dla
-                  required:
-                  - type
-                  - slug
-                  - revision
-                  - internal
-                  type: object
-                state:
-                  enum:
-                  - pending
-                  - validated
-                  - rejected
-              required:
-              - source
-              - ml_class
-              - state
+              properties: {}
         x-name: body
       responses:
         '200':
@@ -527,6 +445,8 @@ paths:
                 - source
                 - ml_class
                 - state
+      tags:
+      - ml
   /api/v1/corpus/:
     get:
       description: List corpora with their access rights
@@ -756,7 +676,8 @@ paths:
       - corpora
   /api/v1/corpus/{id}/classes/:
     get:
-      operationId: ListCorpusMLClass
+      description: List all available classes in a corpus
+      operationId: ListCorpusMLClasses
       parameters:
       - description: ''
         in: path
@@ -776,6 +697,8 @@ paths:
                     type: string
                 required:
                 - name
+      tags:
+      - ml
   /api/v1/corpus/{id}/pages/:
     get:
       description: List all pages in all volumes of a corpus
@@ -4826,7 +4749,8 @@ paths:
       - iiif
   /api/v1/ml-classes/:
     get:
-      operationId: ListMLClass
+      description: List available machine learning classes in all corpora.
+      operationId: ListMLClasses
       parameters:
       - description: A page number within the paginated result set.
         in: query
@@ -4852,6 +4776,8 @@ paths:
                     type: string
                 required:
                 - name
+      tags:
+      - ml
   /api/v1/oauth/credentials/:
     get:
       description: List all OAuth credentials for the authenticated user
-- 
GitLab