
# (c) Secure Identity Alliance

openapi: 3.0.0
info:
  description: |
    The OSIA UIN Interface.

    Change log:
    
    - 1.2.0:
      - Add error structure on 400 errors
      - Force additionalProperties to false when extension is not allowed
      - Add transactionId as a parameter (mandatory)
    - 1.1.0:
      - Addition of security
    - 1.0.0: Initial version

  title: OSIA UIN Interface
  version: 1.2.0
  license:
    name: SIA
    url: "https://raw.githubusercontent.com/SecureIdentityAlliance/osia/master/LICENSE"
servers:
  - url: https://uin.com/
paths:
  /v1/uin:
    post:
      description: |
        Request the generation of a new UIN.
        The request body should contain a list of attributes and their value, formatted as a json dictionary.
      operationId: generateUIN
      security:
        - BearerAuth: [uin.generate]
      parameters:
        - name: transactionId
          in: query
          description: The id of the transaction
          required: true
          schema:
            type: string
      requestBody:
        description: A set of attributes for the person
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Attributes'
            example:
              firstName: John
              lastName: Doo
              dateOfBirth: "1984-11-19"
      responses:
        200:
          description: UIN is generated
          content:
            application/json:
              schema:
                type: string
              example:
                '"1235567890"'
        400:
          description: Unexpected error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        401:
          description: Client must be authenticated
        403:
          description: Service forbidden
        500:
          description: Unexpected error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'

components:
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
  schemas:
    Error:
      type: object
      required:
        - code
        - message
      properties:
        code:
          type: integer
          format: int32
        message:
          type: string
      additionalProperties: false
    Attributes:
      type: object
      additionalProperties:
        oneOf:
        - type: string
        - type: integer
        - type: number
        - type: boolean
      # Or ?:
      #additionalProperties:
      #  type: string
