openapi: 3.0.1
info:
  title: Platform Interoperability Testing API for Platform
  description: This API is for Platform interoperability testing
  version: 0.1.0

components:
  schemas:
    ProblemDetail:
      type: object
      xml:
        name: problem
        namespace: "urn:ietf:rfc:7807"
      properties:
        type:
          type: string
          description: A URI reference that identifies the problem type.
          format: uri
          example: about:blank
        status:
          type: integer
          description: The HTTP status code generated by the origin server for this occurrence of the problem.
          format: int32
          example: 500
        title:
          type: string
          description: A short, human-readable summary of the problem type.
          example: Internal Server Error
        detail:
          type: string
          description: A human-readable explanation specific to this occurrence of the problem.
        instance:
          type: string
          description: A URI reference that identifies the specific occurrence of the problem. It may or may not yield further information if dereferenced.
          format: uri
          example: /api
      required:
        - type
        - status
        - title
        - instance
paths:
  /v0/test-runs:
    post:
      summary: Starts test run for a given datasetId.
      operationId: postStartTestRun
      requestBody:
        required: true
        content:
          application/xml:
            schema:
              type: object
              xml:
                name: startTestRunRequest
              required: [ datasetId ]
              properties:
                datasetId:
                  type: string
                  description: A datasetId that is used in the tests. Must be in UUIDv4 format.
      responses:
        "201":
          description: Test run started with the given datasetId.
          content:
            application/xml:
              schema:
                type: object
                xml:
                  name: startTestRunResponse
                required: [ id ]
                properties:
                  id:
                    type: string
                    description: An identifier for the started test run.
        "404":
          description: Consignment with the given datasetId doesn't exist.
        default:
          description: Unexpected error
          content:
            application/problem+xml:
              schema:
                $ref: "#/components/schemas/ProblemDetail"
  /v0/test-runs/{id}:
    get:
      summary: Get details of a test run.
      parameters:
        - in: path
          name: id
          description: Identifier of a test run.
          schema:
            type: string
          required: true
      operationId: getTestRun
      responses:
        "200":
          description: Details of the test run is returned.
          content:
            application/xml:
              schema:
                type: object
                xml:
                  name: testRunResponse
                required: [ id, status, tests ]
                properties:
                  id:
                    type: string
                    description: Identifier of the test run
                  status:
                    type: string
                    description: Status of the test run
                    enum:
                      - IN_PROGRESS
                      - SUCCESSFUL
                      - FAILED
                  tests:
                    description: A list of performed tests
                    type: array
                    items:
                      type: object
                      required: [ id, outcome ]
                      xml:
                        name: testRunTest
                      properties:
                        id:
                          type: string
                          description: Identifier of a test
                        description:
                          type: string
                          description: A short description of the reason for a FAILED test.
                        status:
                          type: string
                          description: Status of a test
                          enum:
                            - PASSED
                            - FAILED
                            - IN_PROGRESS
                            - QUEUED
        "404":
          description: Could not find a test run with the given id.
        default:
          description: Unexpected error
          content:
            application/problem+xml:
              schema:
                $ref: "#/components/schemas/ProblemDetail"
