Commit 31d34510 authored by Ignacio Dominguez Martinez-Casanueva's avatar Ignacio Dominguez Martinez-Casanueva
Browse files

Add Types API

parent 26ef6680
Loading
Loading
Loading
Loading
+106 −0
Original line number Diff line number Diff line
@@ -1548,7 +1548,103 @@ paths:
          $ref: '#/components/responses/NotFound'
        503:
          $ref: '#/components/responses/ServiceUnavailable'
  /types:
    get:
      tags:
        - Core API
        - Context Information Consumption
      summary: Retrieve available entity types
      description: 5.7.5 Retrieve Available Entity Types
      operationId: retrieveTypes
      parameters:
        # Query params
        - name: details
          in: query
          description: |
            If true, then detailed entity type information represented as an array with
            elements of the Entity Type data structure (clause 5.2.25) is to be returned.
          style: form
          explode: true
          schema:
            type: boolean
          required: false
        # Request headers
        - $ref: '#/components/parameters/Headers.ngsildTenant'
      responses:
        200:
          description: |
            A response body containing the JSON-LD representation of the EntityTypeList
            (clause 5.2.24) is to be returned, unless details=true is specified.

            If details=true is specified, a response body containing a JSON-LD array
            with elements of the EntityType data structure (clause 5.2.25) is to be returned.
          content:
            application/json:
              schema:
                oneOf:
                  - type: array
                    items:
                      $ref: '#/components/schemas/EntityTypeList'
                  - type: array
                    items:
                      $ref: '#/components/schemas/EntityType'
            application/json+ld:
              schema:
                oneOf:
                  - allOf:
                    - type: object
                      required:
                        - '@context'
                      properties:
                        '@context':
                          $ref:  '#/components/schemas/LdContext'
                    - type: array
                      items:
                        $ref: '#/components/schemas/EntityTypeList'
                  - allOf:
                    - type: object
                      required:
                        - '@context'
                      properties:
                        '@context':
                          $ref:  '#/components/schemas/LdContext'
                    - type: array
                      items:
                        $ref: '#/components/schemas/EntityType'
        400:
          $ref: '#/components/responses/BadRequest'
  /types/{type}:
    get:
      tags:
        - Core API
        - Context Information Consumption
      summary: Retrieve available entity type info
      description: 5.7.7 Retrieve Available Entity Type Information
      operationId: retrieveTypeInfo
      parameters:
        # Path params
        - $ref: '#/components/parameters/Path.type'
        # Request headers
        - $ref: '#/components/parameters/Headers.ngsildTenant'
      responses:
        200:
          description: |
            A response body containing the JSON-LD representation of
            the detailed information about the available entity type.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EntityTypeInfo'
            application/json+ld:
              schema:
                allOf:
                  - type: object
                    required:
                      - '@context'
                    properties:
                      '@context':
                        $ref:  '#/components/schemas/LdContext'
                  - $ref: '#/components/schemas/EntityTypeInfo'
components:
  headers:
    Location:
@@ -1630,6 +1726,16 @@ components:
        type: string
        format: uri
      required: true
    Path.type:
      name: type
      in: path
      description: |
        Name of the entity type for which detailed information is to be retrieved.
        The Fully Qualified Name (FQN) as well as the short name can be used,
        given that the latter is part of the JSON-LD @context provided.
      schema:
        type: string
      required: true
    Query.aggrMethods:
      name: aggrMethods
      in: query