From 02cc3e8377f78b61b2c48ebb567e9d6f3f37bc05 Mon Sep 17 00:00:00 2001
From: manon blanco <blanco@teklia.com>
Date: Tue, 21 May 2019 09:27:30 +0000
Subject: [PATCH] change schema for entity

---
 arkindex/schema.yml | 479 +++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 472 insertions(+), 7 deletions(-)

diff --git a/arkindex/schema.yml b/arkindex/schema.yml
index 8be83d2..34e03da 100644
--- a/arkindex/schema.yml
+++ b/arkindex/schema.yml
@@ -561,6 +561,9 @@ paths:
                       path:
                         readOnly: true
                         type: string
+                      s3_url:
+                        readOnly: true
+                        type: string
                       status:
                         enum:
                         - checked
@@ -595,6 +598,152 @@ paths:
       security: []
       tags:
       - elements
+  /api/v1/corpus/{id}/roles/:
+    get:
+      description: List all roles of a corpus
+      operationId: ListCorpusRoles
+      parameters:
+      - description: ''
+        in: path
+        name: id
+        required: true
+        schema:
+          type: string
+      - description: A page number within the paginated result set.
+        in: query
+        name: page
+        required: false
+        schema:
+          type: integer
+      responses:
+        '200':
+          content:
+            application/json:
+              schema:
+                properties:
+                  child_name:
+                    type: string
+                  child_type:
+                    enum:
+                    - person
+                    - location
+                    - subject
+                    - organization
+                    - misc
+                  id:
+                    readOnly: true
+                    type: integer
+                  parent_name:
+                    type: string
+                  parent_type:
+                    enum:
+                    - person
+                    - location
+                    - subject
+                    - organization
+                    - misc
+                required:
+                - parent_name
+                - child_name
+                - parent_type
+                - child_type
+      security: []
+      tags:
+      - elements
+    post:
+      description: Create a new entity role
+      operationId: CreateEntityRole
+      parameters:
+      - description: ''
+        in: path
+        name: id
+        required: true
+        schema:
+          type: string
+      requestBody:
+        content:
+          application/json:
+            schema:
+              properties:
+                child_name:
+                  type: string
+                child_type:
+                  enum:
+                  - person
+                  - location
+                  - subject
+                  - organization
+                  - misc
+                parent_name:
+                  type: string
+                parent_type:
+                  enum:
+                  - person
+                  - location
+                  - subject
+                  - organization
+                  - misc
+              required:
+              - parent_name
+              - child_name
+              - parent_type
+              - child_type
+        x-name: body
+      responses:
+        '200':
+          content:
+            application/json:
+              schema:
+                properties:
+                  child_name:
+                    type: string
+                  child_type:
+                    enum:
+                    - person
+                    - location
+                    - subject
+                    - organization
+                    - misc
+                  id:
+                    readOnly: true
+                    type: integer
+                  parent_name:
+                    type: string
+                  parent_type:
+                    enum:
+                    - person
+                    - location
+                    - subject
+                    - organization
+                    - misc
+                required:
+                - parent_name
+                - child_name
+                - parent_type
+                - child_type
+        '400':
+          content:
+            application/json:
+              examples:
+                role-exists:
+                  summary: Role already exists.
+                  value:
+                    corpus:
+                    - Role already exists in this corpus
+                    id: 55cd009d-cd4b-4ec2-a475-b060f98f9138
+              schema:
+                properties:
+                  corpus:
+                    description: Errors that occured during corpus ID field validation.
+                    readOnly: true
+                    type: array
+                  id:
+                    description: The corpus ID.
+                    readOnly: true
+                    type: string or array
+          description: An error occured while creating the role.
+      tags:
+      - elements
   /api/v1/element/{id}/:
     get:
       description: Retrieve detailed information on a single element
@@ -793,7 +942,8 @@ paths:
               schema:
                 properties:
                   date:
-                    type: date-time
+                    format: date-time
+                    type: string
                   id:
                     type: string
                   revision:
@@ -804,7 +954,8 @@ paths:
                         readOnly: true
                         type: string
                       date:
-                        type: date-time
+                        format: date-time
+                        type: string
                       hash:
                         type: string
                       id:
@@ -1159,6 +1310,9 @@ paths:
                       path:
                         readOnly: true
                         type: string
+                      s3_url:
+                        readOnly: true
+                        type: string
                       status:
                         enum:
                         - checked
@@ -1248,6 +1402,256 @@ paths:
       security: []
       tags:
       - elements
+  /api/v1/entity/:
+    post:
+      description: Create a new entity
+      operationId: CreateEntity
+      parameters: []
+      requestBody:
+        content:
+          application/json:
+            schema:
+              properties:
+                corpus:
+                  type: string
+                id:
+                  type: string
+                metadata:
+                  type: string
+                name:
+                  type: string
+                type:
+                  enum:
+                  - person
+                  - location
+                  - subject
+                  - organization
+                  - misc
+              required:
+              - name
+              - type
+              - corpus
+              - metadata
+        x-name: body
+      responses:
+        '200':
+          content:
+            application/json:
+              schema:
+                properties:
+                  children:
+                    items:
+                      properties:
+                        child:
+                          properties:
+                            id:
+                              type: string
+                            name:
+                              type: string
+                            type:
+                              enum:
+                              - person
+                              - location
+                              - subject
+                              - organization
+                              - misc
+                          required:
+                          - name
+                          - type
+                          type: object
+                        id:
+                          type: string
+                        parent:
+                          properties:
+                            id:
+                              type: string
+                            name:
+                              type: string
+                            type:
+                              enum:
+                              - person
+                              - location
+                              - subject
+                              - organization
+                              - misc
+                          required:
+                          - name
+                          - type
+                          type: object
+                        role:
+                          properties:
+                            child_name:
+                              type: string
+                            child_type:
+                              enum:
+                              - person
+                              - location
+                              - subject
+                              - organization
+                              - misc
+                            id:
+                              readOnly: true
+                              type: integer
+                            parent_name:
+                              type: string
+                            parent_type:
+                              enum:
+                              - person
+                              - location
+                              - subject
+                              - organization
+                              - misc
+                          required:
+                          - parent_name
+                          - child_name
+                          - parent_type
+                          - child_type
+                          type: object
+                      required:
+                      - parent
+                      - child
+                      - role
+                    readOnly: true
+                    type: array
+                  corpus:
+                    type: string
+                  id:
+                    type: string
+                  metadata:
+                    type: string
+                  name:
+                    type: string
+                  parents:
+                    items:
+                      properties:
+                        child:
+                          properties:
+                            id:
+                              type: string
+                            name:
+                              type: string
+                            type:
+                              enum:
+                              - person
+                              - location
+                              - subject
+                              - organization
+                              - misc
+                          required:
+                          - name
+                          - type
+                          type: object
+                        id:
+                          type: string
+                        parent:
+                          properties:
+                            id:
+                              type: string
+                            name:
+                              type: string
+                            type:
+                              enum:
+                              - person
+                              - location
+                              - subject
+                              - organization
+                              - misc
+                          required:
+                          - name
+                          - type
+                          type: object
+                        role:
+                          properties:
+                            child_name:
+                              type: string
+                            child_type:
+                              enum:
+                              - person
+                              - location
+                              - subject
+                              - organization
+                              - misc
+                            id:
+                              readOnly: true
+                              type: integer
+                            parent_name:
+                              type: string
+                            parent_type:
+                              enum:
+                              - person
+                              - location
+                              - subject
+                              - organization
+                              - misc
+                          required:
+                          - parent_name
+                          - child_name
+                          - parent_type
+                          - child_type
+                          type: object
+                      required:
+                      - parent
+                      - child
+                      - role
+                    readOnly: true
+                    type: array
+                  type:
+                    enum:
+                    - person
+                    - location
+                    - subject
+                    - organization
+                    - misc
+                required:
+                - name
+                - type
+                - corpus
+                - metadata
+      tags:
+      - elements
+  /api/v1/entity/link/:
+    post:
+      description: Create a new link between two entities with a role
+      operationId: CreateEntityLink
+      parameters: []
+      requestBody:
+        content:
+          application/json:
+            schema:
+              properties:
+                child:
+                  type: string
+                id:
+                  type: string
+                parent:
+                  type: string
+                role:
+                  type: string
+              required:
+              - parent
+              - child
+              - role
+        x-name: body
+      responses:
+        '200':
+          content:
+            application/json:
+              schema:
+                properties:
+                  child:
+                    type: string
+                  id:
+                    type: string
+                  parent:
+                    type: string
+                  role:
+                    type: string
+                required:
+                - parent
+                - child
+                - role
+      tags:
+      - elements
   /api/v1/entity/{id}/:
     get:
       description: Get all information about entity
@@ -1315,6 +1719,9 @@ paths:
                               - subject
                               - organization
                               - misc
+                            id:
+                              readOnly: true
+                              type: integer
                             parent_name:
                               type: string
                             parent_type:
@@ -1403,6 +1810,9 @@ paths:
                               - subject
                               - organization
                               - misc
+                            id:
+                              readOnly: true
+                              type: integer
                             parent_name:
                               type: string
                             parent_type:
@@ -1436,6 +1846,7 @@ paths:
                 - corpus
                 - children
                 - parents
+      security: []
       tags:
       - elements
   /api/v1/entity/{id}/elements/:
@@ -1493,6 +1904,7 @@ paths:
                     readOnly: true
                 required:
                 - name
+      security: []
       tags:
       - elements
   /api/v1/image/:
@@ -1539,6 +1951,9 @@ paths:
                   s3_put_url:
                     readOnly: true
                     type: string
+                  s3_url:
+                    readOnly: true
+                    type: string
                   status:
                     enum:
                     - checked
@@ -1615,6 +2030,9 @@ paths:
                   path:
                     readOnly: true
                     type: string
+                  s3_url:
+                    readOnly: true
+                    type: string
                   status:
                     enum:
                     - checked
@@ -1666,6 +2084,9 @@ paths:
                   path:
                     readOnly: true
                     type: string
+                  s3_url:
+                    readOnly: true
+                    type: string
                   status:
                     enum:
                     - checked
@@ -1719,6 +2140,9 @@ paths:
                   path:
                     readOnly: true
                     type: string
+                  s3_url:
+                    readOnly: true
+                    type: string
                   status:
                     enum:
                     - checked
@@ -1855,7 +2279,8 @@ paths:
                         readOnly: true
                         type: string
                       date:
-                        type: date-time
+                        format: date-time
+                        type: string
                       hash:
                         type: string
                       id:
@@ -1933,6 +2358,9 @@ paths:
                         path:
                           readOnly: true
                           type: string
+                        s3_url:
+                          readOnly: true
+                          type: string
                         status:
                           enum:
                           - checked
@@ -1951,6 +2379,9 @@ paths:
                   name:
                     readOnly: true
                     type: string
+                  s3_url:
+                    readOnly: true
+                    type: string
                   size:
                     readOnly: true
                     type: integer
@@ -2000,6 +2431,9 @@ paths:
                         path:
                           readOnly: true
                           type: string
+                        s3_url:
+                          readOnly: true
+                          type: string
                         status:
                           enum:
                           - checked
@@ -2018,6 +2452,9 @@ paths:
                   name:
                     readOnly: true
                     type: string
+                  s3_url:
+                    readOnly: true
+                    type: string
                   size:
                     readOnly: true
                     type: integer
@@ -2078,6 +2515,9 @@ paths:
                         path:
                           readOnly: true
                           type: string
+                        s3_url:
+                          readOnly: true
+                          type: string
                         status:
                           enum:
                           - checked
@@ -2096,6 +2536,9 @@ paths:
                   name:
                     readOnly: true
                     type: string
+                  s3_url:
+                    readOnly: true
+                    type: string
                   size:
                     readOnly: true
                     type: integer
@@ -2158,6 +2601,9 @@ paths:
                         path:
                           readOnly: true
                           type: string
+                        s3_url:
+                          readOnly: true
+                          type: string
                         status:
                           enum:
                           - checked
@@ -2176,6 +2622,9 @@ paths:
                   name:
                     readOnly: true
                     type: string
+                  s3_url:
+                    readOnly: true
+                    type: string
                   size:
                     readOnly: true
                     type: integer
@@ -2351,6 +2800,9 @@ paths:
                         path:
                           readOnly: true
                           type: string
+                        s3_url:
+                          readOnly: true
+                          type: string
                         status:
                           enum:
                           - checked
@@ -2369,6 +2821,9 @@ paths:
                   name:
                     readOnly: true
                     type: string
+                  s3_url:
+                    readOnly: true
+                    type: string
                   size:
                     readOnly: true
                     type: integer
@@ -2787,7 +3242,8 @@ paths:
                         readOnly: true
                         type: string
                       date:
-                        type: date-time
+                        format: date-time
+                        type: string
                       hash:
                         type: string
                       id:
@@ -2869,7 +3325,8 @@ paths:
                         readOnly: true
                         type: string
                       date:
-                        type: date-time
+                        format: date-time
+                        type: string
                       hash:
                         type: string
                       id:
@@ -3047,7 +3504,8 @@ paths:
                         readOnly: true
                         type: string
                       date:
-                        type: date-time
+                        format: date-time
+                        type: string
                       hash:
                         type: string
                       id:
@@ -3467,6 +3925,9 @@ paths:
                       path:
                         readOnly: true
                         type: string
+                      s3_url:
+                        readOnly: true
+                        type: string
                       status:
                         enum:
                         - checked
@@ -3789,6 +4250,9 @@ paths:
                           path:
                             readOnly: true
                             type: string
+                          s3_url:
+                            readOnly: true
+                            type: string
                           status:
                             enum:
                             - checked
@@ -4467,8 +4931,9 @@ paths:
               schema:
                 properties:
                   created:
+                    format: date-time
                     readOnly: true
-                    type: date-time
+                    type: string
                   id:
                     type: string
                   state:
-- 
GitLab