Commit 9dfde64e authored by Jerome Royan's avatar Jerome Royan
Browse files

all responses return a json object for homogeneity, even error ones

parent 64f219e8
Loading
Loading
Loading
Loading
+39 −16
Original line number Diff line number Diff line
@@ -157,6 +157,29 @@
        #################
        # 2xx : Success #
        #################
        200_SuccessRequest:
          description: Success request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
                example: "Success request"
        
        200_UuidResponse:
          description: OK, return the UUID of the Trackable defined by the world storage.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
                example: "777266da-e286-11ec-8fea-0242ac120002"

        201_NullResponse: 
          description: Null response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
                example: "Null response"

        #####################
        # 3xx : Redirection #
@@ -168,49 +191,49 @@
        400_BadRequest:
          description: Bad request.
          content:
            text/plain:
            application/json:
              schema:
                type: string
                $ref: '#/components/schemas/Error'
                example: "Bad request"

        400_InvalidUUID:
          description: Invalid UUID supplied.
          content:
            text/plain:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
                example: "The format of the UUID is incorrect"
                type: string

        403_Forbidden:
          description: Not allowed.
          content: 
            text/plain:
            application/json:
              schema:
                type: string
                $ref: '#/components/schemas/Error'
                example: "Not allowed"
                
        404_NotFound:
          description: Not found.
          content:
            text/plain:
            application/json:
              schema:
                type: string
                $ref: '#/components/schemas/Error'
                example: "Not found"

        404_NotFoundUUID:
          description: Not found, could not find UUID in database.
          content:
            text/plain:
            application/json:
              schema:
                type: string
                $ref: '#/components/schemas/Error'
                example: "Element not found"
                  
        405_NotSupported:
          description: Not supported.
          content:
            text/plain:
            application/json:
              schema:
                type: string
                $ref: '#/components/schemas/Error'
                example: "Not supported"        

        4xx_UnexpectedError:      # Can be referenced as '#/components/responses/GenericError'
@@ -223,9 +246,9 @@
        409_NotEmptyUUID:
          description: Invalid UUID, id must be a Nil value.
          content: 
            text/plain:
            application/json:
              schema:
                type: string
                $ref: '#/components/schemas/Error'
                example: "The element you sent has already a value and can't be sent to the world storage"

        ########################
+1 −6
Original line number Diff line number Diff line
@@ -355,12 +355,7 @@ paths:
            example: "bdc83e6b-a89d-4b29-9c99-e9015d448b10"
        responses:
          '200':
            description: OK, unsubcription successful.
            content:
              text/plain:
                schema:
                  type: string
                  example: "Subscription succesfuly deleted"
            $ref: '../common/commonopenapi.yaml#/components/responses/200_SuccessRequest'
          '400':
            $ref: '../common/commonopenapi.yaml#/components/responses/400_BadRequest'
          '404':
+28 −93
Original line number Diff line number Diff line
@@ -170,19 +170,9 @@ paths:
                $ref: '#/components/schemas/Trackable'
      responses:
        '200':
          description: OK, return the UUID of the Trackable defined by the world storage.
          content:
            text/plain:
              schema:
                type: string
                example: "777266da-e286-11ec-8fea-0242ac120002"
          $ref: '../common/commonopenapi.yaml#/components/responses/200_UuidResponse'
        '201':
          description: Null response.
          content:
            text/plain:
              schema:
                type: string
                example: ""
            $ref: '../common/commonopenapi.yaml#/components/responses/201_NullResponse'
        '400':
          $ref: '../common/commonopenapi.yaml#/components/responses/400_BadRequest'
        '409': 
@@ -209,12 +199,7 @@ paths:
                $ref: '#/components/schemas/Trackable'
      responses:
        '200':
          description: OK, return the UUID of the modified Trackable.
          content:
            text/plain:
              schema:
                type: string
                example: "777266da-e286-11ec-8fea-0242ac120002"
          $ref: '../common/commonopenapi.yaml#/components/responses/200_UuidResponse'
        '400':
          $ref: '../common/commonopenapi.yaml#/components/responses/400_BadRequest'
        '404': 
@@ -246,12 +231,7 @@ paths:
                    items:
                      $ref: "#/components/schemas/Trackable"          
        '201':
          description: Null response.
          content:
            text/plain:
              schema:
                type: string
                example: ""
          $ref: '../common/commonopenapi.yaml#/components/responses/201_NullResponse'
        default:
          $ref: '../common/commonopenapi.yaml#/components/responses/4xx_UnexpectedError'

@@ -281,6 +261,8 @@ paths:
            application/json:
              schema:
                $ref: '#/components/schemas/Trackable'
        '201':
          $ref: '../common/commonopenapi.yaml#/components/responses/201_NullResponse' 
        '400':
          $ref: '../common/commonopenapi.yaml#/components/responses/400_InvalidUUID'
        '404':
@@ -305,12 +287,7 @@ paths:
            format: uuid
      responses:
        '200':
          description: OK, delete successful.
          content:
            text/plain:
              schema:
                type: string
                example: "Element succesfully deleted"
          $ref: '../common/commonopenapi.yaml#/components/responses/200_SuccessRequest'
        '400':
          $ref: '../common/commonopenapi.yaml#/components/responses/400_InvalidUUID'
        '404':
@@ -340,19 +317,9 @@ paths:
                $ref: '#/components/schemas/WorldAnchor'
      responses:
        '200':
          description: OK, return the UUID of the World Anchor defined by the world storage.
          content:
            text/plain:
              schema:
                type: string    
                example: "777266da-e286-11ec-8fea-0242ac120002"
          $ref: '../common/commonopenapi.yaml#/components/responses/200_UuidResponse'
        '201':
          description: Null response.
          content:
            text/plain:
              schema:
                type: string
                example: ""
          $ref: '../common/commonopenapi.yaml#/components/responses/201_NullResponse'
        '400':
          $ref: '../common/commonopenapi.yaml#/components/responses/400_BadRequest'
        '409': 
@@ -379,12 +346,9 @@ paths:
                $ref: '#/components/schemas/WorldAnchor'
      responses:
        '200':
          description: OK, return the UUID of the modified World Anchor.
          content:
            text/plain:
              schema:
                type: string
                example: "777266da-e286-11ec-8fea-0242ac120002"
          $ref: '../common/commonopenapi.yaml#/components/responses/200_UuidResponse'
        '201':
          $ref: '../common/commonopenapi.yaml#/components/responses/201_NullResponse'
        '400':
          $ref: '../common/commonopenapi.yaml#/components/responses/400_BadRequest'
        '404': 
@@ -416,12 +380,7 @@ paths:
                    items :
                      $ref: "#/components/schemas/WorldAnchor"          
        '201':
          description: Null response.
          content:
            text/plain:
              schema:
                type: string
                example: ""
          $ref: '../common/commonopenapi.yaml#/components/responses/201_NullResponse'
        default:
          $ref: '../common/commonopenapi.yaml#/components/responses/4xx_UnexpectedError'

@@ -451,6 +410,8 @@ paths:
            application/json:
              schema:
                $ref: '#/components/schemas/WorldAnchor' 
        '201':
          $ref: '../common/commonopenapi.yaml#/components/responses/201_NullResponse'
        '400':
          $ref: '../common/commonopenapi.yaml#/components/responses/400_InvalidUUID'
        '404':
@@ -475,12 +436,7 @@ paths:
            format: uuid
      responses:
        '200':
          description: OK, delete successful.
          content:
            text/plain:
              schema:
                type: string
                example: "Element succesfuly deleted"
          $ref: '../common/commonopenapi.yaml#/components/responses/200_SuccessRequest'
        '400':
          $ref: '../common/commonopenapi.yaml#/components/responses/400_InvalidUUID'
        '404':
@@ -510,19 +466,9 @@ paths:
                $ref: '#/components/schemas/WorldLink'                
      responses:
        '200':
          description: OK, return the UUID of the World Link defined by the world storage.
          content:
            text/plain:
              schema: 
                type: string
                example: "777266da-e286-11ec-8fea-0242ac120002"            
          $ref: '../common/commonopenapi.yaml#/components/responses/200_UuidResponse'            
        '201':
          description: Null response.
          content:
            text/plain:
              schema:
                type: string
                example: ""
          $ref: '../common/commonopenapi.yaml#/components/responses/201_NullResponse'
        '400':
          $ref: '../common/commonopenapi.yaml#/components/responses/400_BadRequest'
        '409': 
@@ -549,12 +495,9 @@ paths:
                $ref: '#/components/schemas/WorldLink'
      responses:
        '200':
          description: OK, return the UUID of the modified World Link.
          content:
            text/plain:
              schema:
                type: string
                example: "777266da-e286-11ec-8fea-0242ac120002"
          $ref: '../common/commonopenapi.yaml#/components/responses/200_UuidResponse'
        '201':
          $ref: '../common/commonopenapi.yaml#/components/responses/201_NullResponse'
        '400':
          $ref: '../common/commonopenapi.yaml#/components/responses/400_BadRequest'
        '404': 
@@ -586,12 +529,7 @@ paths:
                    items :
                      $ref: "#/components/schemas/WorldLink"          
        '201':
          description: Null response.
          content:
            text/plain:
              schema:
                type: string
                example: ""
          $ref: '../common/commonopenapi.yaml#/components/responses/201_NullResponse'
        default:
          $ref: '../common/commonopenapi.yaml#/components/responses/4xx_UnexpectedError'

@@ -621,6 +559,8 @@ paths:
            application/json:
              schema:
                $ref: '#/components/schemas/WorldLink'
        '201':
          $ref: '../common/commonopenapi.yaml#/components/responses/201_NullResponse'
        '400':
          $ref: '../common/commonopenapi.yaml#/components/responses/400_InvalidUUID'
        '404':
@@ -645,12 +585,7 @@ paths:
            format: uuid
      responses:
        '200':
          description: OK, delete successful.
          content:
            text/plain:
              schema:
                type: string
                example: "Element succesfully deleted"
          $ref: '../common/commonopenapi.yaml#/components/responses/200_SuccessRequest'
        '400':
          $ref: '../common/commonopenapi.yaml#/components/responses/400_InvalidUUID'
        '404':