Skip to content

Add WoT-TM-Model to Ditto OpenAPI generator#1

Merged
thjaeckle merged 4 commits into
eclipse-ditto:mainfrom
beyonnex-io:add-wot-openapi-generator-tool
Aug 29, 2025
Merged

Add WoT-TM-Model to Ditto OpenAPI generator#1
thjaeckle merged 4 commits into
eclipse-ditto:mainfrom
beyonnex-io:add-wot-openapi-generator-tool

Conversation

@hu-ahmed

@hu-ahmed hu-ahmed commented Aug 28, 2025

Copy link
Copy Markdown
Contributor

Overview
The WoT to OpenAPI Generator is a Kotlin-based tool that converts WoT (Web of Things) Thing Models in JSON-LD format into OpenAPI 3.1.0 specifications. This generator enables seamless integration between IoT devices and REST APIs by automatically creating comprehensive OpenAPI documentation from WoT schemas.
Key Features
WoT to OpenAPI Conversion: Converts Thing Models to OpenAPI 3.1.0 specifications
Automatic Schema Generation: Generates attribute schemas, feature schemas, and action paths
Ditto Integration: Designed specifically for Eclipse Ditto IoT platform
Flexible Configuration: Supports custom model URLs and Ditto base URLs
Comprehensive Output: Generates complete OpenAPI documentation with proper schemas and endpoints

@thjaeckle thjaeckle moved this to Waiting for Approval in Ditto Planning Aug 28, 2025
@thjaeckle
thjaeckle self-requested a review August 28, 2025 16:27
@thjaeckle thjaeckle changed the title add openapi generator plugin Add WoT-TM-Model to Ditto OpenAPI generator Aug 29, 2025

@thjaeckle thjaeckle left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot @hu-ahmed for this contribution.

I adjusted some build configs and package names and successfully could run the tool with e.g.:

java -jar target/wot-to-openapi-generator-0-SNAPSHOT.jar https://eclipse-ditto.github.io/ditto-examples/wot/models/ dimmable-colored-lamp 1.0.0

Resulting in a generated OpenAPI:

Example OpenAPI
openapi: 3.1.0
info:
  title: Dimmable Colored Lamp
  version: 1.0.0
servers:
- url: https://ditto.example.com/api/2/things
  description: Ditto API
security:
- Bearer: []
tags:
- name: Thing
  description: Complete Dimmable Colored Lamp
- name: Attributes
  description: Attributes of the Dimmable Colored Lamp
- name: Actions
  description: Actions to be invoked on the Dimmable Colored Lamp
paths:
  /{thingId}:
    get:
      tags:
      - Thing
      summary: Retrieves the complete 'Dimmable Colored Lamp' thing
      parameters:
      - $ref: "#/components/parameters/PathParamThingId"
      - $ref: "#/components/parameters/QueryParamFields"
      - $ref: "#/components/parameters/QueryParamCondition"
      responses:
        "200":
          description: Returns complete thing
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/thing"
        "400":
          description: "The request at '/' failed due to bad input, check the error\
            \ for details"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/dittoError_400"
        "401":
          description: Unauthorized to access '/'
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/dittoError_401"
        "404":
          description: Requested path '/' does either not exist or caller has insufficient
            `READ` permissions
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/dittoError_404"
    patch:
      tags:
      - Thing
      summary: Merges the complete 'Dimmable Colored Lamp' thing
      parameters:
      - $ref: "#/components/parameters/PathParamThingId"
      - $ref: "#/components/parameters/QueryParamCondition"
      - name: Content-Type
        in: header
        schema:
          type: string
          example: application/merge-patch+json
      requestBody:
        description: Request payload of merging the complete thing
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/thing"
      responses:
        "201":
          description: The not yet existing thing was successfully created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/thing"
        "204":
          description: The existing thing was successfully merged
        "400":
          description: "The request at '/' failed due to bad input, check the error\
            \ for details"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/dittoError_400"
        "401":
          description: Unauthorized to access '/'
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/dittoError_401"
        "403":
          description: "Forbidden to access '/', ensure caller has required `WRITE`\
            \ permissions"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/dittoError_403"
        "404":
          description: Requested path '/' does either not exist or caller has insufficient
            `READ` permissions
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/dittoError_404"
  /{thingId}/attributes:
    get:
      tags:
      - Attributes
      summary: Retrieves all attributes
      parameters:
      - $ref: "#/components/parameters/PathParamThingId"
      - $ref: "#/components/parameters/QueryParamFields"
      - $ref: "#/components/parameters/QueryParamCondition"
      responses:
        "200":
          description: Returns all attributes
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/attributes"
        "400":
          description: "The request at 'attributes' failed due to bad input, check\
            \ the error for details"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/dittoError_400"
        "401":
          description: Unauthorized to access 'attributes'
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/dittoError_401"
        "404":
          description: Requested path 'attributes' does either not exist or caller
            has insufficient `READ` permissions
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/dittoError_404"
  /{thingId}/attributes/color:
    get:
      tags:
      - Attributes
      summary: Retrieves the 'Color'
      description: The current color.
      parameters:
      - $ref: "#/components/parameters/PathParamThingId"
      - $ref: "#/components/parameters/QueryParamFields"
      - $ref: "#/components/parameters/QueryParamCondition"
      responses:
        "200":
          description: The attribute 'color' is returned
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/attribute_color"
        "400":
          description: "The request at 'attributes/color' failed due to bad input,\
            \ check the error for details"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/dittoError_400"
        "401":
          description: Unauthorized to access 'attributes/color'
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/dittoError_401"
        "404":
          description: Requested path 'attributes/color' does either not exist or
            caller has insufficient `READ` permissions
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/dittoError_404"
    put:
      tags:
      - Attributes
      summary: Replaces the 'Color'
      description: The current color.
      responses:
        "201":
          description: The attribute 'color' was successfully created
          content:
            application/json:
              schema:
                type: object
                description: The current color.
                properties:
                  r:
                    type: integer
                    format: int32
                    maximum: 255
                    minimum: 0
                    readOnly: false
                    title: Red
                    writeOnly: false
                  g:
                    type: integer
                    format: int32
                    maximum: 255
                    minimum: 0
                    readOnly: false
                    title: Green
                    writeOnly: false
                  b:
                    type: integer
                    format: int32
                    maximum: 255
                    minimum: 0
                    readOnly: false
                    title: Blue
                    writeOnly: false
                  w:
                    type: integer
                    format: int32
                    maximum: 255
                    minimum: 0
                    readOnly: false
                    title: White
                    writeOnly: false
                readOnly: false
                title: Color
                writeOnly: false
        "204":
          description: The attribute 'color' was successfully modified
        "400":
          description: "The request at 'attributes/color' failed due to bad input,\
            \ check the error for details"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/dittoError_400"
        "401":
          description: Unauthorized to access 'attributes/color'
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/dittoError_401"
        "403":
          description: "Forbidden to access 'attributes/color', ensure caller has\
            \ required `WRITE` permissions"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/dittoError_403"
        "404":
          description: Requested path 'attributes/color' does either not exist or
            caller has insufficient `READ` permissions
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/dittoError_404"
    patch:
      tags:
      - Attributes
      summary: Merges the 'Color'
      description: The current color.
      responses:
        "201":
          description: The attribute 'color' was successfully created
          content:
            application/json:
              schema:
                type: object
                description: The current color.
                properties:
                  r:
                    type: integer
                    format: int32
                    maximum: 255
                    minimum: 0
                    readOnly: false
                    title: Red
                    writeOnly: false
                  g:
                    type: integer
                    format: int32
                    maximum: 255
                    minimum: 0
                    readOnly: false
                    title: Green
                    writeOnly: false
                  b:
                    type: integer
                    format: int32
                    maximum: 255
                    minimum: 0
                    readOnly: false
                    title: Blue
                    writeOnly: false
                  w:
                    type: integer
                    format: int32
                    maximum: 255
                    minimum: 0
                    readOnly: false
                    title: White
                    writeOnly: false
                readOnly: false
                title: Color
                writeOnly: false
        "204":
          description: The attribute 'color' was successfully merged
        "400":
          description: "The request at 'attributes/color' failed due to bad input,\
            \ check the error for details"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/dittoError_400"
        "401":
          description: Unauthorized to access 'attributes/color'
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/dittoError_401"
        "403":
          description: "Forbidden to access 'attributes/color', ensure caller has\
            \ required `WRITE` permissions"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/dittoError_403"
        "404":
          description: Requested path 'attributes/color' does either not exist or
            caller has insufficient `READ` permissions
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/dittoError_404"
  /{thingId}/attributes/dimmer-level:
    get:
      tags:
      - Attributes
      summary: Retrieves the 'Dimmer level'
      parameters:
      - $ref: "#/components/parameters/PathParamThingId"
      - $ref: "#/components/parameters/QueryParamFields"
      - $ref: "#/components/parameters/QueryParamCondition"
      responses:
        "200":
          description: The attribute 'dimmer-level' is returned
          content:
            application/json:
              schema:
                type: number
                maximum: 1
                minimum: 0
                readOnly: false
                title: Dimmer level
                writeOnly: false
        "400":
          description: "The request at 'attributes/dimmer-level' failed due to bad\
            \ input, check the error for details"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/dittoError_400"
        "401":
          description: Unauthorized to access 'attributes/dimmer-level'
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/dittoError_401"
        "404":
          description: Requested path 'attributes/dimmer-level' does either not exist
            or caller has insufficient `READ` permissions
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/dittoError_404"
    put:
      tags:
      - Attributes
      summary: Replaces the 'Dimmer level'
      responses:
        "201":
          description: The attribute 'dimmer-level' was successfully created
          content:
            application/json:
              schema:
                type: number
                maximum: 1
                minimum: 0
                readOnly: false
                title: Dimmer level
                writeOnly: false
        "204":
          description: The attribute 'dimmer-level' was successfully modified
        "400":
          description: "The request at 'attributes/dimmer-level' failed due to bad\
            \ input, check the error for details"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/dittoError_400"
        "401":
          description: Unauthorized to access 'attributes/dimmer-level'
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/dittoError_401"
        "403":
          description: "Forbidden to access 'attributes/dimmer-level', ensure caller\
            \ has required `WRITE` permissions"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/dittoError_403"
        "404":
          description: Requested path 'attributes/dimmer-level' does either not exist
            or caller has insufficient `READ` permissions
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/dittoError_404"
    patch:
      tags:
      - Attributes
      summary: Merges the 'Dimmer level'
      responses:
        "201":
          description: The attribute 'dimmer-level' was successfully created
          content:
            application/json:
              schema:
                type: number
                maximum: 1
                minimum: 0
                readOnly: false
                title: Dimmer level
                writeOnly: false
        "204":
          description: The attribute 'dimmer-level' was successfully merged
        "400":
          description: "The request at 'attributes/dimmer-level' failed due to bad\
            \ input, check the error for details"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/dittoError_400"
        "401":
          description: Unauthorized to access 'attributes/dimmer-level'
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/dittoError_401"
        "403":
          description: "Forbidden to access 'attributes/dimmer-level', ensure caller\
            \ has required `WRITE` permissions"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/dittoError_403"
        "404":
          description: Requested path 'attributes/dimmer-level' does either not exist
            or caller has insufficient `READ` permissions
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/dittoError_404"
  /{thingId}/attributes/on:
    get:
      tags:
      - Attributes
      summary: Retrieves the 'On'
      description: Whether the switch is on or off.
      parameters:
      - $ref: "#/components/parameters/PathParamThingId"
      - $ref: "#/components/parameters/QueryParamFields"
      - $ref: "#/components/parameters/QueryParamCondition"
      responses:
        "200":
          description: The attribute 'on' is returned
          content:
            application/json:
              schema:
                type: boolean
                description: Whether the switch is on or off.
                readOnly: false
                title: "On"
                writeOnly: false
        "400":
          description: "The request at 'attributes/on' failed due to bad input, check\
            \ the error for details"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/dittoError_400"
        "401":
          description: Unauthorized to access 'attributes/on'
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/dittoError_401"
        "404":
          description: Requested path 'attributes/on' does either not exist or caller
            has insufficient `READ` permissions
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/dittoError_404"
    put:
      tags:
      - Attributes
      summary: Replaces the 'On'
      description: Whether the switch is on or off.
      responses:
        "201":
          description: The attribute 'on' was successfully created
          content:
            application/json:
              schema:
                type: boolean
                description: Whether the switch is on or off.
                readOnly: false
                title: "On"
                writeOnly: false
        "204":
          description: The attribute 'on' was successfully modified
        "400":
          description: "The request at 'attributes/on' failed due to bad input, check\
            \ the error for details"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/dittoError_400"
        "401":
          description: Unauthorized to access 'attributes/on'
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/dittoError_401"
        "403":
          description: "Forbidden to access 'attributes/on', ensure caller has required\
            \ `WRITE` permissions"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/dittoError_403"
        "404":
          description: Requested path 'attributes/on' does either not exist or caller
            has insufficient `READ` permissions
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/dittoError_404"
    patch:
      tags:
      - Attributes
      summary: Merges the 'On'
      description: Whether the switch is on or off.
      responses:
        "201":
          description: The attribute 'on' was successfully created
          content:
            application/json:
              schema:
                type: boolean
                description: Whether the switch is on or off.
                readOnly: false
                title: "On"
                writeOnly: false
        "204":
          description: The attribute 'on' was successfully merged
        "400":
          description: "The request at 'attributes/on' failed due to bad input, check\
            \ the error for details"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/dittoError_400"
        "401":
          description: Unauthorized to access 'attributes/on'
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/dittoError_401"
        "403":
          description: "Forbidden to access 'attributes/on', ensure caller has required\
            \ `WRITE` permissions"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/dittoError_403"
        "404":
          description: Requested path 'attributes/on' does either not exist or caller
            has insufficient `READ` permissions
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/dittoError_404"
  /{thingId}/inbox/messages/toggle:
    post:
      tags:
      - Actions
      summary: Invokes the 'Toggle' action
      description: Toggles/inverts the current 'on' state.
      parameters:
      - $ref: "#/components/parameters/PathParamThingId"
      - $ref: "#/components/parameters/QueryParamCondition"
      responses:
        "200":
          description: The custom response of the 'toggle' action - the status code
            is also custom
          content:
            application/json:
              schema:
                type: boolean
                readOnly: false
                title: New 'on' state
                writeOnly: false
        "400":
          description: "The request at 'inbox/messages/toggle' failed due to bad input,\
            \ check the error for details"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/dittoError_400"
        "401":
          description: Unauthorized to access 'inbox/messages/toggle'
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/dittoError_401"
        "403":
          description: "Forbidden to access 'inbox/messages/toggle', ensure caller\
            \ has required `WRITE` permissions"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/dittoError_403"
        "404":
          description: Requested path 'inbox/messages/toggle' does either not exist
            or caller has insufficient `READ` permissions
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/dittoError_404"
        "408":
          description: The request could not be completed due to timeout
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/dittoError_408"
  /{thingId}/inbox/messages/switch-on-for-duration:
    post:
      tags:
      - Actions
      summary: Invokes the 'Switch on for duration' action
      description: "Switches the switchable on for a given duration, then switches\
        \ back to the previous state."
      parameters:
      - $ref: "#/components/parameters/PathParamThingId"
      - $ref: "#/components/parameters/QueryParamCondition"
      requestBody:
        description: Request payload of the 'Switch on for duration' action
        content:
          application/json:
            schema:
              type: integer
              format: int32
              readOnly: false
              title: Duration in seconds
              writeOnly: false
      responses:
        "200":
          description: The custom response of the 'switch-on-for-duration' action
            - the status code is also custom
        "400":
          description: "The request at 'inbox/messages/switch-on-for-duration' failed\
            \ due to bad input, check the error for details"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/dittoError_400"
        "401":
          description: Unauthorized to access 'inbox/messages/switch-on-for-duration'
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/dittoError_401"
        "403":
          description: "Forbidden to access 'inbox/messages/switch-on-for-duration',\
            \ ensure caller has required `WRITE` permissions"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/dittoError_403"
        "404":
          description: Requested path 'inbox/messages/switch-on-for-duration' does
            either not exist or caller has insufficient `READ` permissions
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/dittoError_404"
        "408":
          description: The request could not be completed due to timeout
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/dittoError_408"
components:
  schemas:
    dittoError_400:
      type: object
      description: Provides additional information about an occurred error and how
        to resolve it
      example: "{\"status\":400,\"error\":\"things:id.invalid\",\"message\":\"Thing\
        \ ID 'nope' is not valid!\",\"description\":\"It must conform to the namespaced\
        \ entity ID notation (see Ditto documentation)\",\"href\":null}"
      properties:
        status:
          type: integer
          format: int32
          description: "The status code of the error with HTTP status code semantics\
            \ (e.g.: 4xx for user errors, 5xx for server errors)"
          maximum: 599
          minimum: 400
          title: Status code
        error:
          type: string
          description: The error code or identifier that uniquely identifies the error
          title: Error code
        message:
          type: string
          description: The human readable message that explains what went wrong during
            the execution of a command/message
          title: Error message
        description:
          type: string
          description: Contains further information about the error e.g. a hint what
            caused the problem and how to solve it
          title: Error description
        href:
          type: string
          format: uri
          description: A link to further information about the error and how to fix
            it
          title: Error link
      required:
      - status
      - error
      - message
      title: Ditto error
    dittoError_401:
      type: object
      description: Provides additional information about an occurred error and how
        to resolve it
      example: "{\"status\":401,\"error\":\"gateway:authentication.failed\",\"message\"\
        :\"The JWT was missing.\",\"description\":\"Check if your credentials were\
        \ correct.\",\"href\":null}"
      properties:
        status:
          type: integer
          format: int32
          description: "The status code of the error with HTTP status code semantics\
            \ (e.g.: 4xx for user errors, 5xx for server errors)"
          maximum: 599
          minimum: 400
          title: Status code
        error:
          type: string
          description: The error code or identifier that uniquely identifies the error
          title: Error code
        message:
          type: string
          description: The human readable message that explains what went wrong during
            the execution of a command/message
          title: Error message
        description:
          type: string
          description: Contains further information about the error e.g. a hint what
            caused the problem and how to solve it
          title: Error description
        href:
          type: string
          format: uri
          description: A link to further information about the error and how to fix
            it
          title: Error link
      required:
      - status
      - error
      - message
      title: Ditto error
    dittoError_403:
      type: object
      description: Provides additional information about an occurred error and how
        to resolve it
      example: "{\"status\":403,\"error\":\"things:thing.notmodifiable\",\"message\"\
        :\"The Thing with ID 'some:thing' could not be modified as the requester had\
        \ insufficient permissions ('WRITE' is required).\",\"description\":\"Check\
        \ if the ID of your requested Thing was correct and you have sufficient permissions.\"\
        ,\"href\":null}"
      properties:
        status:
          type: integer
          format: int32
          description: "The status code of the error with HTTP status code semantics\
            \ (e.g.: 4xx for user errors, 5xx for server errors)"
          maximum: 599
          minimum: 400
          title: Status code
        error:
          type: string
          description: The error code or identifier that uniquely identifies the error
          title: Error code
        message:
          type: string
          description: The human readable message that explains what went wrong during
            the execution of a command/message
          title: Error message
        description:
          type: string
          description: Contains further information about the error e.g. a hint what
            caused the problem and how to solve it
          title: Error description
        href:
          type: string
          format: uri
          description: A link to further information about the error and how to fix
            it
          title: Error link
      required:
      - status
      - error
      - message
      title: Ditto error
    dittoError_404:
      type: object
      description: Provides additional information about an occurred error and how
        to resolve it
      example: "{\"status\":404,\"error\":\"things:thing.notfound\",\"message\":\"\
        The Thing with ID 'some:thing' could not be found or requester had insufficient\
        \ permissions to access it.\",\"description\":\"Check if the ID of your requested\
        \ Thing was correct and you have sufficient permissions.\",\"href\":null}"
      properties:
        status:
          type: integer
          format: int32
          description: "The status code of the error with HTTP status code semantics\
            \ (e.g.: 4xx for user errors, 5xx for server errors)"
          maximum: 599
          minimum: 400
          title: Status code
        error:
          type: string
          description: The error code or identifier that uniquely identifies the error
          title: Error code
        message:
          type: string
          description: The human readable message that explains what went wrong during
            the execution of a command/message
          title: Error message
        description:
          type: string
          description: Contains further information about the error e.g. a hint what
            caused the problem and how to solve it
          title: Error description
        href:
          type: string
          format: uri
          description: A link to further information about the error and how to fix
            it
          title: Error link
      required:
      - status
      - error
      - message
      title: Ditto error
    dittoError_408:
      type: object
      description: Provides additional information about an occurred error and how
        to resolve it
      example: "{\"status\":408,\"error\":\"command.timeout\",\"message\":\"The Command\
        \ reached the specified timeout of {10000}ms.\",\"description\":\"Try increasing\
        \ the command timeout.\",\"href\":null}"
      properties:
        status:
          type: integer
          format: int32
          description: "The status code of the error with HTTP status code semantics\
            \ (e.g.: 4xx for user errors, 5xx for server errors)"
          maximum: 599
          minimum: 400
          title: Status code
        error:
          type: string
          description: The error code or identifier that uniquely identifies the error
          title: Error code
        message:
          type: string
          description: The human readable message that explains what went wrong during
            the execution of a command/message
          title: Error message
        description:
          type: string
          description: Contains further information about the error e.g. a hint what
            caused the problem and how to solve it
          title: Error description
        href:
          type: string
          format: uri
          description: A link to further information about the error and how to fix
            it
          title: Error link
      required:
      - status
      - error
      - message
      title: Ditto error
    attribute_color:
      type: object
      description: The current color.
      properties:
        r:
          $ref: "#/components/schemas/attribute_color_r"
        g:
          $ref: "#/components/schemas/attribute_color_g"
        b:
          $ref: "#/components/schemas/attribute_color_b"
        w:
          $ref: "#/components/schemas/attribute_color_w"
      readOnly: false
      required:
      - r
      - g
      - b
      title: Color
      writeOnly: false
    attribute_color_r:
      type: integer
      format: int32
      maximum: 255
      minimum: 0
      readOnly: false
      title: Red
      writeOnly: false
    attribute_color_g:
      type: integer
      format: int32
      maximum: 255
      minimum: 0
      readOnly: false
      title: Green
      writeOnly: false
    attribute_color_b:
      type: integer
      format: int32
      maximum: 255
      minimum: 0
      readOnly: false
      title: Blue
      writeOnly: false
    attribute_color_w:
      type: integer
      format: int32
      maximum: 255
      minimum: 0
      readOnly: false
      title: White
      writeOnly: false
    attribute_dimmer-level:
      type: number
      maximum: 1
      minimum: 0
      readOnly: false
      title: Dimmer level
      writeOnly: false
    attribute_on:
      type: boolean
      description: Whether the switch is on or off.
      readOnly: false
      title: "On"
      writeOnly: false
    attributes:
      type: object
      properties:
        color:
          $ref: "#/components/schemas/attribute_color"
        dimmer-level:
          $ref: "#/components/schemas/attribute_dimmer-level"
        "on":
          $ref: "#/components/schemas/attribute_on"
    thing:
      type: object
      properties:
        thingId:
          type: string
        policyId:
          type: string
        definition:
          type: string
        attributes:
          $ref: "#/components/schemas/attributes"
        features:
          $ref: "#/components/schemas/features"
    features:
      type: object
  parameters:
    PathParamThingId:
      name: thingId
      in: path
      description: |-
        The ID of a thing needs to follow the namespaced entity ID notation
        (see [Ditto documentation on namespaced entity IDs](https://www.eclipse.dev/ditto/basic-namespaces-and-names.html#namespaced-id))
      required: true
      schema:
        type: string
    QueryParamCondition:
      name: condition
      in: query
      description: |-
        Defines that the [request should be done conditionally](https://eclipse.dev/ditto/basic-conditional-requests.html)
        only be processed if the given condition is met.
        The condition can be specified using [RQL](https://eclipse.dev/ditto/basic-rql.html) syntax.

        The `condition` can be passed for both, `GET` verb (conditional request) and modifying verbs (conditional update).

        #### Examples
        E.g. if the temperature is not 23.9 update it to 23.9:
        * `?condition=ne(features/temperature/properties/value,23.9)`

           `body: 23.9`
      required: false
      schema:
        type: string
    QueryParamFields:
      name: fields
      in: query
      description: |-
        Contains a comma-separated list of fields to be included in the returned JSON, performing a
        [partial request](https://eclipse.dev/ditto/httpapi-concepts.html#with-field-selector).

        #### Selectable fields

        Supports selecting arbitrary sub-fields  by using a comma-separated list:
          * several properties paths can be passed as a comma-separated list of JSON pointers (RFC-6901)

            For example:
              * `?fields=model` would select only `model` value (if present)
              * `?fields=model,make` would select `model` and `make` values (if present)

        Supports selecting arbitrary sub-fields of objects by wrapping sub-fields inside parentheses `( )`:
          * a comma-separated list of sub-fields (a sub-field is a JSON pointer (RFC-6901) separated with `/`) to select
          * sub-selectors can be used to request only specific sub-fields by placing expressions in parentheses `( )` after a selected subfield

            For example:
             * `?fields=location(longitude,latitude)` would select the `longitude` and `latitude` value inside the `location` object

        #### Examples

        * `?fields=model,make,location(longitude,latitude)`
        * `?fields=listOfAddresses/postal(city,street))`
      required: false
      schema:
        type: string
  securitySchemes:
    Bearer:
      type: http
      description: A JSON Web Token issued by a configured OpenID Connect Identity
        Provider
      name: Bearer
      scheme: bearer
      bearerFormat: JWT

@thjaeckle
thjaeckle merged commit 058835d into eclipse-ditto:main Aug 29, 2025
3 checks passed
@github-project-automation github-project-automation Bot moved this from Waiting for Approval to Done in Ditto Planning Aug 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants