diff --git a/ext/hivemq-edge-openapi-2025.14.yaml b/ext/hivemq-edge-openapi-2025.14.yaml index 109e12c57d..b9a0673cd9 100644 --- a/ext/hivemq-edge-openapi-2025.14.yaml +++ b/ext/hivemq-edge-openapi-2025.14.yaml @@ -14,7 +14,7 @@ info: ## OpenAPI HiveMQ's REST API provides an OpenAPI 3.0 schema definition that can imported into popular API tooling (e.g. Postman) or can be used to generate client-code for multiple programming languages. title: HiveMQ Edge REST API - version: 2025.14-SNAPSHOT + version: 2025.12-SNAPSHOT x-logo: url: https://www.hivemq.com/img/svg/hivemq-bee.svg tags: @@ -357,12 +357,23 @@ paths: schema: $ref: '#/components/schemas/BehaviorPolicyList' description: Success + '400': + content: + application/problem+json: + schema: + oneOf: + - $ref: '#/components/schemas/InvalidQueryParameterError' + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/InvalidQueryParameterError: '#/components/schemas/InvalidQueryParameterError' + description: URL parameter missing '503': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' - description: Temporarily not available + $ref: '#/components/schemas/TemporaryNotAvailableError' + description: Request resource temporary unavailable summary: Get all policies tags: - Data Hub - Behavior Policies @@ -447,34 +458,45 @@ paths: description: Success '400': content: - application/json: - schema: - $ref: '#/components/schemas/ProblemDetails' + application/problem+json: + schema: + oneOf: + - $ref: '#/components/schemas/BehaviorPolicyCreationFailureError' + - $ref: '#/components/schemas/BehaviorPolicyInvalidErrors' + - $ref: '#/components/schemas/BehaviorPolicyRejectedError' + - $ref: '#/components/schemas/RequestBodyMissingError' + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/BehaviorPolicyCreationFailureError: '#/components/schemas/BehaviorPolicyCreationFailureError' + https://hivemq.com/edge/api/model/BehaviorPolicyInvalidErrors: '#/components/schemas/BehaviorPolicyInvalidErrors' + https://hivemq.com/edge/api/model/BehaviorPolicyRejectedError: '#/components/schemas/BehaviorPolicyRejectedError' + https://hivemq.com/edge/api/model/RequestBodyMissingError: '#/components/schemas/RequestBodyMissingError' description: Policy creation failed '409': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' - description: Already exists + $ref: '#/components/schemas/BehaviorPolicyAlreadyPresentError' + description: Behavior policy already present '500': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' - description: Internal error + $ref: '#/components/schemas/InternalServerError' + description: Internal server error '503': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' - description: Temporarily unavailable + $ref: '#/components/schemas/TemporaryNotAvailableError' + description: Request resource temporary unavailable '507': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' - description: Insufficient storage error + $ref: '#/components/schemas/PolicyInsufficientStorageError' + description: Insufficient storage summary: Create a new policy tags: - Data Hub - Behavior Policies @@ -504,34 +526,39 @@ paths: description: Success, no response body '400': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + oneOf: + - $ref: '#/components/schemas/UrlParameterMissingError' + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/UrlParameterMissingError: '#/components/schemas/UrlParameterMissingError' description: URL parameter missing '404': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' - description: Policy not found + $ref: '#/components/schemas/PolicyNotFoundError' + description: Behavior policy not found '412': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/PreconditionFailedError' description: Precondition failed '500': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' - description: Internal error + $ref: '#/components/schemas/InternalServerError' + description: Internal server error '503': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' - description: Temporarily not available + $ref: '#/components/schemas/TemporaryNotAvailableError' + description: Request resource temporary unavailable summary: Delete a behavior policy tags: - Data Hub - Behavior Policies @@ -599,16 +626,33 @@ paths: description: Success '400': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' - description: Invalid query parameter + oneOf: + - $ref: '#/components/schemas/UrlParameterMissingError' + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/UrlParameterMissingError: '#/components/schemas/UrlParameterMissingError' + description: Bad request '404': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/BehaviorPolicyNotFoundError' description: Policy not found + '500': + content: + application/problem+json: + schema: + $ref: '#/components/schemas/InternalServerError' + description: Internal server error + '503': + content: + application/problem+json: + schema: + $ref: '#/components/schemas/TemporaryNotAvailableError' + description: Request resource temporary unavailable summary: Get a policy tags: - Data Hub - Behavior Policies @@ -709,41 +753,56 @@ paths: description: Success '400': content: - application/json: - schema: - $ref: '#/components/schemas/ProblemDetails' - description: Policy creation failed + application/problem+json: + schema: + oneOf: + - $ref: '#/components/schemas/RequestBodyMissingError' + - $ref: '#/components/schemas/UrlParameterMissingError' + - $ref: '#/components/schemas/BehaviorPolicyCreationFailureError' + - $ref: '#/components/schemas/BehaviorPolicyInvalidErrors' + - $ref: '#/components/schemas/BehaviorPolicyUpdateFailureError' + - $ref: '#/components/schemas/PolicyIdMismatchError' + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/RequestBodyMissingError: '#/components/schemas/RequestBodyMissingError' + https://hivemq.com/edge/api/model/UrlParameterMissingError: '#/components/schemas/UrlParameterMissingError' + https://hivemq.com/edge/api/model/BehaviorPolicyCreationFailureError: '#/components/schemas/BehaviorPolicyCreationFailureError' + https://hivemq.com/edge/api/model/BehaviorPolicyInvalidErrors: '#/components/schemas/BehaviorPolicyInvalidErrors' + https://hivemq.com/edge/api/model/BehaviorPolicyUpdateFailureError: '#/components/schemas/BehaviorPolicyUpdateFailureError' + https://hivemq.com/edge/api/model/PolicyIdMismatchError: '#/components/schemas/PolicyIdMismatchError' + description: Behavior policy creation failed '404': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' - description: Policy not found + $ref: '#/components/schemas/BehaviorPolicyNotFoundError' + description: Data policy not found '412': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/PreconditionFailedError' description: Precondition failed '500': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' - description: Internal error + $ref: '#/components/schemas/InternalServerError' + description: Internal server error '503': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' - description: Temporarily unavailable + $ref: '#/components/schemas/TemporaryNotAvailableError' + description: Request resource temporary unavailable '507': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' - description: Insufficient storage error - summary: Update an existing policy + $ref: '#/components/schemas/PolicyInsufficientStorageError' + description: Insufficient storage + summary: Update an existing behavior policy tags: - Data Hub - Behavior Policies /api/v1/data-hub/behavior-validation/states/{clientId}: @@ -787,22 +846,34 @@ paths: description: Success '400': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + oneOf: + - $ref: '#/components/schemas/UrlParameterMissingError' + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/UrlParameterMissingError: '#/components/schemas/UrlParameterMissingError' description: URL parameter missing '404': content: - application/json: - schema: - $ref: '#/components/schemas/ProblemDetails' - description: Client is disconnected + application/problem+json: + schema: + oneOf: + - $ref: '#/components/schemas/ClientDisconnectedError' + - $ref: '#/components/schemas/ClientNotFoundError' + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/ClientDisconnectedError: '#/components/schemas/ClientDisconnectedError' + https://hivemq.com/edge/api/model/ClientNotFoundError: '#/components/schemas/ClientNotFoundError' + description: Client error '500': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' - description: Internal Server error + $ref: '#/components/schemas/InternalServerError' + description: Internal server error summary: Get the state of a client tags: - Data Hub - State @@ -1051,27 +1122,20 @@ paths: description: Success '400': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + oneOf: + - $ref: '#/components/schemas/InvalidQueryParameterError' + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/InvalidQueryParameterError: '#/components/schemas/InvalidQueryParameterError' description: URL parameter missing - '404': - content: - application/json: - schema: - $ref: '#/components/schemas/ProblemDetails' - description: DataPolicy not found - '500': - content: - application/json: - schema: - $ref: '#/components/schemas/ProblemDetails' - description: Internal server error '503': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/TemporaryNotAvailableError' description: Request resource temporary unavailable summary: Get all data policies tags: @@ -1155,33 +1219,44 @@ paths: description: Success '400': content: - application/json: - schema: - $ref: '#/components/schemas/ProblemDetails' - description: DataPolicy creation failed + application/problem+json: + schema: + oneOf: + - $ref: '#/components/schemas/RequestBodyMissingError' + - $ref: '#/components/schemas/DataPolicyCreationFailureError' + - $ref: '#/components/schemas/DataPolicyInvalidErrors' + - $ref: '#/components/schemas/DataPolicyRejectedError' + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/RequestBodyMissingError: '#/components/schemas/RequestBodyMissingError' + https://hivemq.com/edge/api/model/DataPolicyCreationFailureError: '#/components/schemas/DataPolicyCreationFailureError' + https://hivemq.com/edge/api/model/DataPolicyInvalidErrors: '#/components/schemas/DataPolicyInvalidErrors' + https://hivemq.com/edge/api/model/DataPolicyRejectedError: '#/components/schemas/DataPolicyRejectedError' + description: Data policy creation failed '409': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' - description: DataPolicy already present + $ref: '#/components/schemas/DataPolicyAlreadyPresentError' + description: Data policy already present '500': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/InternalServerError' description: Internal server error '503': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/TemporaryNotAvailableError' description: Request resource temporary unavailable '507': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/PolicyInsufficientStorageError' description: Insufficient storage summary: Create a new data policy tags: @@ -1212,27 +1287,38 @@ paths: description: Success, no response body '400': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + oneOf: + - $ref: '#/components/schemas/UrlParameterMissingError' + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/UrlParameterMissingError: '#/components/schemas/UrlParameterMissingError' description: URL parameter missing '404': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' - description: DataPolicy not found + $ref: '#/components/schemas/PolicyNotFoundError' + description: Data policy not found + '412': + content: + application/problem+json: + schema: + $ref: '#/components/schemas/PreconditionFailedError' + description: Precondition failed '500': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/InternalServerError' description: Internal server error '503': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/TemporaryNotAvailableError' description: Request resource temporary unavailable summary: Delete a data policy tags: @@ -1300,32 +1386,33 @@ paths: description: Success '400': content: - application/json: - examples: - param-missing: - description: Example response when a required parameter is missing. - summary: Required URL parameter missing - value: - errors: - - title: Required parameter missing - detail: Required URL parameter 'parameterName' is missing + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + oneOf: + - $ref: '#/components/schemas/UrlParameterMissingError' + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/UrlParameterMissingError: '#/components/schemas/UrlParameterMissingError' description: Bad request '404': content: - application/json: - examples: - not-found: - description: Policy not found - summary: Not found - value: - errors: - - title: Resource not found - detail: Resource with id 'my-resource-id' not found + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/PolicyNotFoundError' description: Resource not found + '500': + content: + application/problem+json: + schema: + $ref: '#/components/schemas/InternalServerError' + description: Internal server error + '503': + content: + application/problem+json: + schema: + $ref: '#/components/schemas/TemporaryNotAvailableError' + description: Request resource temporary unavailable summary: Get a data policy tags: - Data Hub - Data Policies @@ -1425,33 +1512,56 @@ paths: description: Success '400': content: - application/json: - schema: - $ref: '#/components/schemas/ProblemDetails' - description: DataPolicy creation failed + application/problem+json: + schema: + oneOf: + - $ref: '#/components/schemas/RequestBodyMissingError' + - $ref: '#/components/schemas/UrlParameterMissingError' + - $ref: '#/components/schemas/DataPolicyCreationFailureError' + - $ref: '#/components/schemas/DataPolicyInvalidErrors' + - $ref: '#/components/schemas/DataPolicyUpdateFailureError' + - $ref: '#/components/schemas/PolicyIdMismatchError' + - $ref: '#/components/schemas/TopicFilterMismatchError' + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/RequestBodyMissingError: '#/components/schemas/RequestBodyMissingError' + https://hivemq.com/edge/api/model/UrlParameterMissingError: '#/components/schemas/UrlParameterMissingError' + https://hivemq.com/edge/api/model/DataPolicyCreationFailureError: '#/components/schemas/DataPolicyCreationFailureError' + https://hivemq.com/edge/api/model/DataPolicyInvalidErrors: '#/components/schemas/DataPolicyInvalidErrors' + https://hivemq.com/edge/api/model/DataPolicyUpdateFailureError: '#/components/schemas/DataPolicyUpdateFailureError' + https://hivemq.com/edge/api/model/PolicyIdMismatchError: '#/components/schemas/PolicyIdMismatchError' + https://hivemq.com/edge/api/model/TopicFilterMismatchError: '#/components/schemas/TopicFilterMismatchError' + description: Data policy creation failed '404': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' - description: DataPolicy not found + $ref: '#/components/schemas/DataPolicyNotFoundError' + description: Data policy not found + '412': + content: + application/problem+json: + schema: + $ref: '#/components/schemas/PreconditionFailedError' + description: Precondition failed '500': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/InternalServerError' description: Internal server error '503': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/TemporaryNotAvailableError' description: Request resource temporary unavailable '507': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/PolicyInsufficientStorageError' description: Insufficient storage summary: Update an existing data policy tags: @@ -1537,9 +1647,9 @@ paths: description: Success '500': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/Errors' + $ref: '#/components/schemas/InternalServerError' description: Internal server error summary: Get all FSMs as a JSON Schema tags: @@ -1699,9 +1809,9 @@ paths: description: Success '500': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/InternalServerError' description: Internal server error summary: Get all functions as a JSON Schema tags: @@ -1719,9 +1829,9 @@ paths: description: Success '500': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/InternalServerError' description: Internal server error summary: Get all interpolation variables tags: @@ -1739,9 +1849,9 @@ paths: description: Success '500': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/InternalServerError' description: Internal server error summary: Get all functions as a list of function specifications tags: @@ -1876,11 +1986,22 @@ paths: schema: $ref: '#/components/schemas/SchemaList' description: Success + '400': + content: + application/problem+json: + schema: + oneOf: + - $ref: '#/components/schemas/InvalidQueryParameterError' + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/InvalidQueryParameterError: '#/components/schemas/InvalidQueryParameterError' + description: URL parameter missing '503': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/TemporaryNotAvailableError' description: Request resource temporary unavailable summary: Get all schemas tags: @@ -1927,33 +2048,48 @@ paths: description: Success '400': content: - application/json: - schema: - $ref: '#/components/schemas/ProblemDetails' - description: Schema could not be validatetd + application/problem+json: + schema: + oneOf: + - $ref: '#/components/schemas/RequestBodyParameterMissingError' + - $ref: '#/components/schemas/SchemaInvalidErrors' + - $ref: '#/components/schemas/SchemaParsingFailureError' + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/RequestBodyParameterMissingError: '#/components/schemas/RequestBodyParameterMissingError' + https://hivemq.com/edge/api/model/SchemaInvalidErrors: '#/components/schemas/SchemaInvalidErrors' + https://hivemq.com/edge/api/model/SchemaParsingFailureError: '#/components/schemas/SchemaParsingFailureError' + description: Schema creation failed '409': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' - description: Schema already exists + $ref: '#/components/schemas/SchemaAlreadyPresentError' + description: Schema is already present '412': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' - description: Mismatch between schema and etag + $ref: '#/components/schemas/SchemaEtagMismatchError' + description: Schema doesn't match etag '500': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/InternalServerError' description: Internal server error + '503': + content: + application/problem+json: + schema: + $ref: '#/components/schemas/TemporaryNotAvailableError' + description: Request resource temporary unavailable '507': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/SchemaInsufficientStorageError' description: Insufficient storage summary: Create a new schema tags: @@ -1984,33 +2120,40 @@ paths: description: Success, no response body '400': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' - description: Schema referenced + oneOf: + - $ref: '#/components/schemas/UrlParameterMissingError' + - $ref: '#/components/schemas/SchemaReferencedError' + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/UrlParameterMissingError: '#/components/schemas/UrlParameterMissingError' + https://hivemq.com/edge/api/model/SchemaReferencedError: '#/components/schemas/SchemaReferencedError' + description: URL parameter missing '404': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/SchemaNotFoundError' description: Schema not found '412': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' - description: Mismatch between schema and etag + $ref: '#/components/schemas/SchemaEtagMismatchError' + description: Schema doesn't match etag '500': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' - description: Internal server error + $ref: '#/components/schemas/InternalServerError' + description: Internal Server error '503': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/TemporaryNotAvailableError' description: Request resource temporary unavailable summary: Delete all versions of the schema tags: @@ -2056,22 +2199,33 @@ paths: description: Success '400': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' - description: A url parameter is missing + oneOf: + - $ref: '#/components/schemas/UrlParameterMissingError' + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/UrlParameterMissingError: '#/components/schemas/UrlParameterMissingError' + description: URL parameter missing '404': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/SchemaNotFoundError' description: Schema not found '500': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/InternalServerError' description: Internal server error + '503': + content: + application/problem+json: + schema: + $ref: '#/components/schemas/TemporaryNotAvailableError' + description: Request resource temporary unavailable summary: Get a schema tags: - Data Hub - Schemas @@ -2192,12 +2346,23 @@ paths: schema: $ref: '#/components/schemas/ScriptList' description: Success + '400': + content: + application/problem+json: + schema: + oneOf: + - $ref: '#/components/schemas/InvalidQueryParameterError' + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/InvalidQueryParameterError: '#/components/schemas/InvalidQueryParameterError' + description: URL parameter missing '503': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' - description: Temporary not available + $ref: '#/components/schemas/TemporaryNotAvailableError' + description: Request resource temporary unavailable summary: Get all scripts tags: - Data Hub - Scripts @@ -2243,39 +2408,52 @@ paths: description: Success '400': content: - application/json: - schema: - $ref: '#/components/schemas/ProblemDetails' - description: Script is invalid + application/problem+json: + schema: + oneOf: + - $ref: '#/components/schemas/RequestBodyParameterMissingError' + - $ref: '#/components/schemas/ScriptCreationFailureError' + - $ref: '#/components/schemas/ScriptInvalidErrors' + - $ref: '#/components/schemas/ScriptParsingFailureError' + - $ref: '#/components/schemas/ScriptSanitationFailureError' + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/RequestBodyParameterMissingError: '#/components/schemas/RequestBodyParameterMissingError' + https://hivemq.com/edge/api/model/ScriptCreationFailureError: '#/components/schemas/ScriptCreationFailureError' + https://hivemq.com/edge/api/model/ScriptInvalidErrors: '#/components/schemas/ScriptInvalidErrors' + https://hivemq.com/edge/api/model/ScriptParsingFailureError: '#/components/schemas/ScriptParsingFailureError' + https://hivemq.com/edge/api/model/ScriptSanitationFailureError: '#/components/schemas/ScriptSanitationFailureError' + description: Script creation failed '409': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/ScriptAlreadyPresentError' description: Script is already present '412': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/ScriptEtagMismatchError' description: Script doesn't match etag '500': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/InternalServerError' description: Internal server error '503': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' - description: Temporary not available + $ref: '#/components/schemas/TemporaryNotAvailableError' + description: Request resource temporary unavailable '507': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/ScriptInsufficientStorageError' description: Insufficient storage summary: Create a new script tags: @@ -2303,34 +2481,41 @@ paths: description: Success, no response body '400': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' - description: Script is referenced + oneOf: + - $ref: '#/components/schemas/UrlParameterMissingError' + - $ref: '#/components/schemas/ScriptReferencedError' + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/UrlParameterMissingError: '#/components/schemas/UrlParameterMissingError' + https://hivemq.com/edge/api/model/ScriptReferencedError: '#/components/schemas/ScriptReferencedError' + description: URL parameter missing '404': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/ScriptNotFoundError' description: Script not found '412': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/ScriptEtagMismatchError' description: Script doesn't match etag '500': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/InternalServerError' description: Internal Server error '503': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' - description: Temporary not available + $ref: '#/components/schemas/TemporaryNotAvailableError' + description: Request resource temporary unavailable summary: Delete a script tags: - Data Hub - Scripts @@ -2371,28 +2556,33 @@ paths: description: Success '400': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + oneOf: + - $ref: '#/components/schemas/UrlParameterMissingError' + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/UrlParameterMissingError: '#/components/schemas/UrlParameterMissingError' description: URL parameter missing '404': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/ScriptNotFoundError' description: Script not found '500': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/InternalServerError' description: Internal Server error '503': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' - description: Temporary not available + $ref: '#/components/schemas/TemporaryNotAvailableError' + description: Request resource temporary unavailable summary: Get a script tags: - Data Hub - Scripts @@ -4868,6 +5058,7 @@ components: detail: type: string errors: + deprecated: true type: array items: $ref: '#/components/schemas/Error' @@ -5032,25 +5223,1283 @@ components: description: List of result items that are returned by this endpoint items: $ref: '#/components/schemas/BehaviorPolicy' - JsonNode: - type: object - description: The arguments of the fsm derived from the behavior policy. - FsmStateInformationItem: - type: object - description: List of result items that are returned by this endpoint - properties: - arguments: - $ref: '#/components/schemas/JsonNode' - behaviorId: - type: string - description: The unique identifier of the policy. - firstSetAt: - type: string - description: The timestamp when this state was set the first time. - policyId: - type: string - description: The unique identifier of the policy. - stateName: + ApiProblemDetails: + allOf: + - $ref: '#/components/schemas/ProblemDetails' + - type: object + required: + - detail + - status + - type + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/BehaviorPolicyAlreadyPresentError: '#/components/schemas/BehaviorPolicyAlreadyPresentError' + https://hivemq.com/edge/api/model/BehaviorPolicyCreationFailureError: '#/components/schemas/BehaviorPolicyCreationFailureError' + https://hivemq.com/edge/api/model/BehaviorPolicyInvalidErrors: '#/components/schemas/BehaviorPolicyInvalidErrors' + https://hivemq.com/edge/api/model/BehaviorPolicyNotFoundError: '#/components/schemas/BehaviorPolicyNotFoundError' + https://hivemq.com/edge/api/model/BehaviorPolicyRejectedError: '#/components/schemas/BehaviorPolicyRejectedError' + https://hivemq.com/edge/api/model/BehaviorPolicyUpdateFailureError: '#/components/schemas/BehaviorPolicyUpdateFailureError' + https://hivemq.com/edge/api/model/ClientDisconnectedError: '#/components/schemas/ClientDisconnectedError' + https://hivemq.com/edge/api/model/ClientNotFoundError: '#/components/schemas/ClientNotFoundError' + https://hivemq.com/edge/api/model/DataPolicyAlreadyPresentError: '#/components/schemas/DataPolicyAlreadyPresentError' + https://hivemq.com/edge/api/model/DataPolicyCreationFailureError: '#/components/schemas/DataPolicyCreationFailureError' + https://hivemq.com/edge/api/model/DataPolicyInvalidErrors: '#/components/schemas/DataPolicyInvalidErrors' + https://hivemq.com/edge/api/model/DataPolicyNotFoundError: '#/components/schemas/DataPolicyNotFoundError' + https://hivemq.com/edge/api/model/DataPolicyRejectedError: '#/components/schemas/DataPolicyRejectedError' + https://hivemq.com/edge/api/model/DataPolicyUpdateFailureError: '#/components/schemas/DataPolicyUpdateFailureError' + https://hivemq.com/edge/api/model/PolicyIdMismatchError: '#/components/schemas/PolicyIdMismatchError' + https://hivemq.com/edge/api/model/PolicyInsufficientStorageError: '#/components/schemas/PolicyInsufficientStorageError' + https://hivemq.com/edge/api/model/PolicyNotFoundError: '#/components/schemas/PolicyNotFoundError' + https://hivemq.com/edge/api/model/SchemaAlreadyPresentError: '#/components/schemas/SchemaAlreadyPresentError' + https://hivemq.com/edge/api/model/SchemaEtagMismatchError: '#/components/schemas/SchemaEtagMismatchError' + https://hivemq.com/edge/api/model/SchemaInsufficientStorageError: '#/components/schemas/SchemaInsufficientStorageError' + https://hivemq.com/edge/api/model/SchemaInvalidErrors: '#/components/schemas/SchemaInvalidErrors' + https://hivemq.com/edge/api/model/SchemaNotFoundError: '#/components/schemas/SchemaNotFoundError' + https://hivemq.com/edge/api/model/SchemaParsingFailureError: '#/components/schemas/SchemaParsingFailureError' + https://hivemq.com/edge/api/model/SchemaReferencedError: '#/components/schemas/SchemaReferencedError' + https://hivemq.com/edge/api/model/ScriptAlreadyPresentError: '#/components/schemas/ScriptAlreadyPresentError' + https://hivemq.com/edge/api/model/ScriptCreationFailureError: '#/components/schemas/ScriptCreationFailureError' + https://hivemq.com/edge/api/model/ScriptEtagMismatchError: '#/components/schemas/ScriptEtagMismatchError' + https://hivemq.com/edge/api/model/ScriptInsufficientStorageError: '#/components/schemas/ScriptInsufficientStorageError' + https://hivemq.com/edge/api/model/ScriptInvalidErrors: '#/components/schemas/ScriptInvalidErrors' + https://hivemq.com/edge/api/model/ScriptNotFoundError: '#/components/schemas/ScriptNotFoundError' + https://hivemq.com/edge/api/model/ScriptParsingFailureError: '#/components/schemas/ScriptParsingFailureError' + https://hivemq.com/edge/api/model/ScriptReferencedError: '#/components/schemas/ScriptReferencedError' + https://hivemq.com/edge/api/model/ScriptSanitationFailureError: '#/components/schemas/ScriptSanitationFailureError' + https://hivemq.com/edge/api/model/TopicFilterMismatchError: '#/components/schemas/TopicFilterMismatchError' + https://hivemq.com/edge/api/model/InsufficientStorageError: '#/components/schemas/InsufficientStorageError' + https://hivemq.com/edge/api/model/InternalServerError: '#/components/schemas/InternalServerError' + https://hivemq.com/edge/api/model/InvalidQueryParameterError: '#/components/schemas/InvalidQueryParameterError' + https://hivemq.com/edge/api/model/PreconditionFailedError: '#/components/schemas/PreconditionFailedError' + https://hivemq.com/edge/api/model/RequestBodyMissingError: '#/components/schemas/RequestBodyMissingError' + https://hivemq.com/edge/api/model/RequestBodyParameterMissingError: '#/components/schemas/RequestBodyParameterMissingError' + https://hivemq.com/edge/api/model/TemporaryNotAvailableError: '#/components/schemas/TemporaryNotAvailableError' + https://hivemq.com/edge/api/model/UrlParameterMissingError: '#/components/schemas/UrlParameterMissingError' + BehaviorPolicyAlreadyPresentError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + - type: object + properties: + id: + type: string + description: The behavior policy id. + example: abc + required: + - id + example: + general: + status: 409 + title: Behavior Policy Already Present + detail: The given behavior policy 'abc' is already present. + id: abc + type: https://hivemq.com/edge/api/model/BehaviorPolicyAlreadyPresentError + BehaviorPolicyCreationFailureError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + example: + general: + status: 400 + title: Behavior Policy Creation Failed + detail: 'Behavior policy creation failed: The policy was rejected.' + type: https://hivemq.com/edge/api/model/BehaviorPolicyCreationFailureError + AtLeastOneFieldMissingValidationError: + allOf: + - $ref: '#/components/schemas/ValidationError' + - type: object + properties: + paths: + type: array + description: The missing json paths. + items: + type: string + format: json-path + description: The json path. + example: + - $.field1 + - $.field2 + required: + - paths + example: + general: + detail: 'At least one of the fields must be present: ''$.field1'', ''$.field2''.' + paths: + - $.field1 + - $.field2 + type: https://hivemq.com/edge/api/model/AtLeastOneFieldMissingValidationError + ValidationError: + type: object + properties: + detail: + type: string + description: Detailed contextual description of the validation error. + type: + type: string + format: uri + description: Type of the validation error. + required: + - detail + - type + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/AtLeastOneFieldMissingValidationError: '#/components/schemas/AtLeastOneFieldMissingValidationError' + https://hivemq.com/edge/api/model/AtMostOneFunctionValidationError: '#/components/schemas/AtMostOneFunctionValidationError' + https://hivemq.com/edge/api/model/EmptyFieldValidationError: '#/components/schemas/EmptyFieldValidationError' + https://hivemq.com/edge/api/model/FunctionMustBePairedValidationError: '#/components/schemas/FunctionMustBePairedValidationError' + https://hivemq.com/edge/api/model/IllegalEventTransitionValidationError: '#/components/schemas/IllegalEventTransitionValidationError' + https://hivemq.com/edge/api/model/IllegalFunctionValidationError: '#/components/schemas/IllegalFunctionValidationError' + https://hivemq.com/edge/api/model/InvalidFieldLengthValidationError: '#/components/schemas/InvalidFieldLengthValidationError' + https://hivemq.com/edge/api/model/InvalidFieldValueValidationError: '#/components/schemas/InvalidFieldValueValidationError' + https://hivemq.com/edge/api/model/InvalidFunctionOrderValidationError: '#/components/schemas/InvalidFunctionOrderValidationError' + https://hivemq.com/edge/api/model/InvalidIdentifierValidationError: '#/components/schemas/InvalidIdentifierValidationError' + https://hivemq.com/edge/api/model/InvalidSchemaVersionValidationError: '#/components/schemas/InvalidSchemaVersionValidationError' + https://hivemq.com/edge/api/model/MissingFieldValidationError: '#/components/schemas/MissingFieldValidationError' + https://hivemq.com/edge/api/model/UnknownVariableValidationError: '#/components/schemas/UnknownVariableValidationError' + https://hivemq.com/edge/api/model/UnsupportedFieldValidationError: '#/components/schemas/UnsupportedFieldValidationError' + AtMostOneFunctionValidationError: + allOf: + - $ref: '#/components/schemas/ValidationError' + - type: object + properties: + function: + type: string + description: The function. + example: function1 + occurrences: + type: integer + format: int32 + description: The occurrences of the function. + minimum: 0 + example: 3 + paths: + type: array + items: + type: string + format: json-path + description: The json paths where the function occurs. + example: + - $.path1 + - $.path2 + - $.path3 + required: + - function + - occurrences + - paths + example: + general: + detail: The pipeline must contain at most one 'function1' function, but 3 were found at ['$.path1', '$.path2', '$.path3']. + function: function1 + occurrences: 3 + paths: + - $.path1 + - $.path2 + - $.path3 + type: https://hivemq.com/edge/api/model/AtMostOneFunctionValidationError + EmptyFieldValidationError: + allOf: + - $ref: '#/components/schemas/ValidationError' + - type: object + properties: + path: + type: string + format: json-path + description: The missing field. + example: $.field + required: + - path + example: + general: + detail: Required field '$.field' is empty. + path: $.field + type: https://hivemq.com/edge/api/model/EmptyFieldValidationError + FunctionMustBePairedValidationError: + allOf: + - $ref: '#/components/schemas/ValidationError' + - type: object + properties: + existingFunction: + type: string + description: The existing function. + example: function1 + missingFunction: + type: string + description: The missing function. + example: function2 + required: + - existingFunction + - missingFunction + example: + general: + detail: If 'function1' function is present in the pipeline, 'function2' function must be present as well. + existingFunction: function1 + missingFunction: function2 + type: https://hivemq.com/edge/api/model/FunctionMustBePairedValidationError + IllegalEventTransitionValidationError: + allOf: + - $ref: '#/components/schemas/ValidationError' + - type: object + properties: + event: + type: string + description: The event name. + example: event1 + fromState: + type: string + description: The event from state. + example: state1 + id: + type: string + description: The event id. + example: abc + path: + type: string + description: The path. + example: $.event + toState: + type: string + description: The event to state. + example: state2 + required: + - event + - fromState + - id + - path + - toState + example: + general: + detail: The transition from state 'state1' to state 'state2' on event 'event1' in '$.event' is not defined for behavior 'abc'. + event: event1 + fromState: state1 + toState: state2 + id: abc + path: $.event + type: https://hivemq.com/edge/api/model/IllegalEventTransitionValidationError + IllegalFunctionValidationError: + allOf: + - $ref: '#/components/schemas/ValidationError' + - type: object + properties: + event: + type: string + description: The event name. + example: event1 + id: + type: string + description: The function id. + example: abc + path: + type: string + format: json-path + description: The json path. + example: $.event + required: + - event + - id + - path + example: + general: + detail: The function 'abc' is not allowed for event 'event1' in '$.event'. + event: event1 + id: abc + path: $.event + type: https://hivemq.com/edge/api/model/IllegalFunctionValidationError + InvalidFieldLengthValidationError: + allOf: + - $ref: '#/components/schemas/ValidationError' + - type: object + properties: + actualLength: + type: integer + format: int32 + description: The actual length of the field value. + example: 10 + expectedMinimumLength: + type: integer + format: int32 + description: The minimum length expected for the field value. + minimum: 0 + example: 5 + expectedMaximumLength: + type: integer + format: int32 + description: The maximum length expected for the field value. + minimum: 0 + example: 20 + path: + type: string + format: json-path + description: The invalid json path. + example: $.field + value: + type: string + description: The invalid value. + example: function transform() { return 'Hello, World!'; } + required: + - actualLength + - expectedMinimumLength + - expectedMaximumLength + - path + - value + example: + general: + detail: The length of script field '$.transform' 48 must be between 0 and 20. + actualLength: 48 + minimumLength: 0 + maximumLength: 20 + path: $.transform + value: function transform() { return 'Hello, World!'; } + type: https://hivemq.com/edge/api/model/InvalidFieldLengthValidationError + InvalidFieldValueValidationError: + allOf: + - $ref: '#/components/schemas/ValidationError' + - type: object + properties: + path: + type: string + format: json-path + description: The invalid json path. + example: $.action.pipeline[1].field + value: + type: string + description: The invalid value. + example: functionDoesNotExist + required: + - path + example: + general: + detail: Referenced function does not exist. + path: $.action.pipeline[1].field + value: functionDoesNotExist + type: https://hivemq.com/edge/api/model/InvalidFieldValueValidationError + InvalidFunctionOrderValidationError: + allOf: + - $ref: '#/components/schemas/ValidationError' + - type: object + properties: + function: + type: string + description: The function. + example: transform + path: + type: string + format: json-path + description: The json path. + example: $.path + previousFunction: + type: string + description: The previous function. + example: init + required: + - function + - path + - previousFunction + example: + general: + detail: The operation at '$.path' with the functionId 'transform' must be after a 'init' operation. + function: transform + path: $.path + previousFunction: init + type: https://hivemq.com/edge/api/model/InvalidFunctionOrderValidationError + InvalidIdentifierValidationError: + allOf: + - $ref: '#/components/schemas/ValidationError' + - type: object + properties: + path: + type: string + format: json-path + description: The invalid identifier path. + example: $.id + value: + type: string + description: The invalid identifier value. + example: invalidId + required: + - path + - value + example: + general: + detail: Identifier script 'id' must begin with a letter and may only consist of lowercase letters, uppercase letters, numbers, periods, hyphens, and underscores. + path: $.id + value: invalidId + type: https://hivemq.com/edge/api/model/InvalidIdentifierValidationError + InvalidSchemaVersionValidationError: + allOf: + - $ref: '#/components/schemas/ValidationError' + - type: object + properties: + id: + type: string + description: The schema id. + example: abc + version: + type: string + description: The schema version. + example: '2' + required: + - id + - version + example: + general: + detail: The referenced schema with id 'abc' and version '2' was not found. + id: abc + version: '2' + type: https://hivemq.com/edge/api/model/InvalidSchemaVersionValidationError + MissingFieldValidationError: + allOf: + - $ref: '#/components/schemas/ValidationError' + - type: object + properties: + path: + type: string + format: json-path + description: The missing path. + example: $.id + required: + - path + example: + general: + detail: Required field '$.id' is missing. + path: $.id + type: https://hivemq.com/edge/api/model/MissingFieldValidationError + UnknownVariableValidationError: + allOf: + - $ref: '#/components/schemas/ValidationError' + - type: object + properties: + path: + type: string + description: The json path of the field. + example: $.path + variables: + type: array + items: + type: string + description: The unknown variables. + example: + - a + - b + - c + required: + - path + - variables + example: + general: + detail: 'Field ''$.path'' contains unknown variables: [a, b, c].' + path: $.path + variables: + - a + - b + - c + type: https://hivemq.com/edge/api/model/UnknownVariableValidationError + UnsupportedFieldValidationError: + allOf: + - $ref: '#/components/schemas/ValidationError' + - type: object + properties: + actualValue: + type: string + description: The actual value. + expectedValue: + type: string + description: The expected value. + path: + type: string + format: json-path + description: The json path. + example: $.id + required: + - actualValue + - expectedValue + - path + example: + general: + detail: Unsupported type 'String' for field '$.id'. Expected type is 'Object'. + actualValue: String + expectedValue: Object + path: $.id + type: https://hivemq.com/edge/api/model/UnsupportedFieldValidationError + BehaviorPolicyValidationError: + allOf: + - $ref: '#/components/schemas/ValidationError' + - oneOf: + - $ref: '#/components/schemas/IllegalEventTransitionValidationError' + - $ref: '#/components/schemas/IllegalFunctionValidationError' + - $ref: '#/components/schemas/InvalidSchemaVersionValidationError' + - $ref: '#/components/schemas/AtLeastOneFieldMissingValidationError' + - $ref: '#/components/schemas/EmptyFieldValidationError' + - $ref: '#/components/schemas/InvalidFieldLengthValidationError' + - $ref: '#/components/schemas/InvalidFieldValueValidationError' + - $ref: '#/components/schemas/InvalidIdentifierValidationError' + - $ref: '#/components/schemas/MissingFieldValidationError' + - $ref: '#/components/schemas/UnsupportedFieldValidationError' + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/AtLeastOneFieldMissingValidationError: '#/components/schemas/AtLeastOneFieldMissingValidationError' + https://hivemq.com/edge/api/model/EmptyFieldValidationError: '#/components/schemas/EmptyFieldValidationError' + https://hivemq.com/edge/api/model/IllegalEventTransitionValidationError: '#/components/schemas/IllegalEventTransitionValidationError' + https://hivemq.com/edge/api/model/IllegalFunctionValidationError: '#/components/schemas/IllegalFunctionValidationError' + https://hivemq.com/edge/api/model/InvalidFieldLengthValidationError: '#/components/schemas/InvalidFieldLengthValidationError' + https://hivemq.com/edge/api/model/InvalidFieldValueValidationError: '#/components/schemas/InvalidFieldValueValidationError' + https://hivemq.com/edge/api/model/InvalidIdentifierValidationError: '#/components/schemas/InvalidIdentifierValidationError' + https://hivemq.com/edge/api/model/InvalidSchemaVersionValidationError: '#/components/schemas/InvalidSchemaVersionValidationError' + https://hivemq.com/edge/api/model/MissingFieldValidationError: '#/components/schemas/MissingFieldValidationError' + https://hivemq.com/edge/api/model/UnsupportedFieldValidationError: '#/components/schemas/UnsupportedFieldValidationError' + BehaviorPolicyInvalidErrors: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + - type: object + properties: + childErrors: + type: array + description: List of child validation errors. + items: + $ref: '#/components/schemas/BehaviorPolicyValidationError' + required: + - childErrors + example: + general: + status: 400 + title: Behavior Policy Invalid + detail: Behavior policy is invalid due to validation errors. + type: https://hivemq.com/edge/api/model/BehaviorPolicyInvalidErrors + childErrors: + - detail: The transition from state 'state1' to state 'state2' on event 'event1' in '$.path' is not defined for behavior 'id1'. + fromState: state1 + toState: state2 + path: $.path + id: id1 + type: https://hivemq.com/edge/api/model/IllegalEventTransitionValidationError + BehaviorPolicyNotFoundError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + - type: object + properties: + id: + type: string + description: The data policy id. + example: abc + required: + - id + example: + general: + status: 404 + title: Behavior Policy Not Found + detail: Behavior policy with ID 'abc' is not found. + id: abc + type: https://hivemq.com/edge/api/model/BehaviorPolicyNotFoundError + BehaviorPolicyRejectedError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + example: + general: + status: 400 + title: Behavior Policy Rejected + detail: Behavior policy is rejected. + type: https://hivemq.com/edge/api/model/BehaviorPolicyRejectedError + BehaviorPolicyUpdateFailureError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + - type: object + properties: + id: + type: string + description: The ID of the policy that failed to update. + example: abc + required: + - id + example: + general: + status: 400 + title: Behavior Policy Update Failed + detail: Behavior policy with ID 'abc' update failed. + id: abc + type: https://hivemq.com/edge/api/model/BehaviorPolicyUpdateFailureError + ClientDisconnectedError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + - type: object + properties: + id: + type: string + description: The client id. + example: abc + required: + - id + example: + general: + status: 404 + title: Client Disconnected + detail: Client with ID 'abc' is disconnected. + id: abc + type: https://hivemq.com/edge/api/model/ClientDisconnectedError + ClientNotFoundError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + - type: object + properties: + id: + type: string + description: The client id. + example: abc + required: + - id + example: + general: + status: 404 + title: Client Not Found + detail: Client with ID 'abc' is not found. + id: abc + type: https://hivemq.com/edge/api/model/ClientNotFoundError + DataPolicyAlreadyPresentError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + - type: object + properties: + id: + type: string + description: The data policy id. + example: abc + required: + - id + example: + general: + status: 409 + title: Data Policy Already Present + detail: The given data policy 'abc' is already present. + id: abc + type: https://hivemq.com/edge/api/model/DataPolicyAlreadyPresentError + DataPolicyCreationFailureError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + example: + general: + status: 400 + title: Data Policy Creation Failed + detail: 'Data policy creation failed: The policy was rejected.' + type: https://hivemq.com/edge/api/model/DataPolicyCreationFailureError + DataPolicyValidationError: + allOf: + - $ref: '#/components/schemas/ValidationError' + - oneOf: + - $ref: '#/components/schemas/AtMostOneFunctionValidationError' + - $ref: '#/components/schemas/FunctionMustBePairedValidationError' + - $ref: '#/components/schemas/InvalidFunctionOrderValidationError' + - $ref: '#/components/schemas/InvalidSchemaVersionValidationError' + - $ref: '#/components/schemas/UnknownVariableValidationError' + - $ref: '#/components/schemas/EmptyFieldValidationError' + - $ref: '#/components/schemas/InvalidFieldLengthValidationError' + - $ref: '#/components/schemas/InvalidFieldValueValidationError' + - $ref: '#/components/schemas/InvalidIdentifierValidationError' + - $ref: '#/components/schemas/MissingFieldValidationError' + - $ref: '#/components/schemas/UnsupportedFieldValidationError' + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/AtMostOneFunctionValidationError: '#/components/schemas/AtMostOneFunctionValidationError' + https://hivemq.com/edge/api/model/EmptyFieldValidationError: '#/components/schemas/EmptyFieldValidationError' + https://hivemq.com/edge/api/model/FunctionMustBePairedValidationError: '#/components/schemas/FunctionMustBePairedValidationError' + https://hivemq.com/edge/api/model/InvalidFieldLengthValidationError: '#/components/schemas/InvalidFieldLengthValidationError' + https://hivemq.com/edge/api/model/InvalidFieldValueValidationError: '#/components/schemas/InvalidFieldValueValidationError' + https://hivemq.com/edge/api/model/InvalidFunctionOrderValidationError: '#/components/schemas/InvalidFunctionOrderValidationError' + https://hivemq.com/edge/api/model/InvalidIdentifierValidationError: '#/components/schemas/InvalidIdentifierValidationError' + https://hivemq.com/edge/api/model/InvalidSchemaVersionValidationError: '#/components/schemas/InvalidSchemaVersionValidationError' + https://hivemq.com/edge/api/model/MissingFieldValidationError: '#/components/schemas/MissingFieldValidationError' + https://hivemq.com/edge/api/model/UnknownVariableValidationError: '#/components/schemas/UnknownVariableValidationError' + https://hivemq.com/edge/api/model/UnsupportedFieldValidationError: '#/components/schemas/UnsupportedFieldValidationError' + DataPolicyInvalidErrors: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + - type: object + properties: + childErrors: + type: array + description: List of child validation errors. + items: + $ref: '#/components/schemas/DataPolicyValidationError' + required: + - childErrors + example: + general: + status: 400 + title: Data Policy Invalid + detail: Data policy is invalid due to validation errors. + type: https://hivemq.com/edge/api/model/DataPolicyInvalidErrors + childErrors: + - detail: The pipeline must contain at most one 'function1' function, but 3 were found at ['$.path1', '$.path2', '$.path3']. + function: function1 + occurrences: 3 + paths: + - $.path1 + - $.path2 + - $.path3 + type: https://hivemq.com/edge/api/model/AtMostOneFunctionValidationError + DataPolicyNotFoundError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + - type: object + properties: + id: + type: string + description: The data policy id. + example: abc + required: + - id + example: + general: + status: 404 + title: Data Policy Not Found + detail: Data policy with ID 'abc' is not found. + id: abc + type: https://hivemq.com/edge/api/model/DataPolicyNotFoundError + DataPolicyRejectedError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + example: + general: + status: 400 + title: Data Policy Rejected + detail: Data policy is rejected. + type: https://hivemq.com/edge/api/model/DataPolicyRejectedError + DataPolicyUpdateFailureError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + - type: object + properties: + id: + type: string + description: The ID of the policy that failed to update. + example: abc + required: + - id + example: + general: + status: 400 + title: Data Policy Update Failed + detail: Data policy with ID 'abc' update failed. + id: abc + type: https://hivemq.com/edge/api/model/DataPolicyUpdateFailureError + PolicyIdMismatchError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + - type: object + properties: + actualId: + type: string + description: The actual id. + example: id1 + expectedId: + type: string + description: The expected id. + example: id2 + required: + - actualId + - expectedId + example: + general: + status: 400 + title: Policy ID Mismatch + detail: The policy ID 'id1' in the request parameter does not match the policy ID 'id2' in the policy request body. + id: abc + type: https://hivemq.com/edge/api/model/PolicyIdMismatchError + PolicyInsufficientStorageError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + - type: object + properties: + id: + type: string + description: The policy id. + example: abc + required: + - id + example: + general: + status: 507 + title: Policy Insufficient Storage + detail: Policy with ID '123' could not be added because of insufficient server storage. + id: abc + type: https://hivemq.com/edge/api/model/PolicyInsufficientStorageError + PolicyNotFoundError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + - type: object + properties: + id: + type: string + description: The policy id. + example: abc + required: + - id + example: + general: + status: 404 + title: Policy Not Found + detail: Policy with ID 'abc' is not found. + id: abc + type: https://hivemq.com/edge/api/model/PolicyNotFoundError + SchemaAlreadyPresentError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + - type: object + properties: + id: + type: string + description: The schema id. + example: abc + required: + - id + example: + general: + status: 409 + title: Schema Already Present + detail: The given schema is already present as the latest version for the schema id 'abc'. + id: abc + type: https://hivemq.com/edge/api/model/SchemaAlreadyPresentError + SchemaEtagMismatchError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + - type: object + properties: + id: + type: string + description: The schema id. + example: abc + eTag: + type: string + description: The eTag. + example: 33a64df551425fcc55e4d42a148795d9f25f89d4 + required: + - id + example: + general: + status: 412 + title: Schema eTag Mismatch + detail: Schema with id 'abc' does not match the given etag '33a64df551425fcc55e4d42a148795d9f25f89d4'. + id: abc + eTag: 33a64df551425fcc55e4d42a148795d9f25f89d4 + type: https://hivemq.com/edge/api/model/SchemaEtagMismatchError + SchemaInsufficientStorageError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + - type: object + properties: + id: + type: string + description: The policy id. + example: abc + required: + - id + example: + general: + status: 507 + title: Schema Insufficient Storage + detail: Schema with ID '123' could not be added because of insufficient server storage. + id: abc + type: https://hivemq.com/edge/api/model/SchemaInsufficientStorageError + SchemaValidationError: + allOf: + - $ref: '#/components/schemas/ValidationError' + - oneOf: + - $ref: '#/components/schemas/EmptyFieldValidationError' + - $ref: '#/components/schemas/InvalidFieldLengthValidationError' + - $ref: '#/components/schemas/InvalidFieldValueValidationError' + - $ref: '#/components/schemas/InvalidIdentifierValidationError' + - $ref: '#/components/schemas/MissingFieldValidationError' + - $ref: '#/components/schemas/UnsupportedFieldValidationError' + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/EmptyFieldValidationError: '#/components/schemas/EmptyFieldValidationError' + https://hivemq.com/edge/api/model/InvalidFieldLengthValidationError: '#/components/schemas/InvalidFieldLengthValidationError' + https://hivemq.com/edge/api/model/InvalidFieldValueValidationError: '#/components/schemas/InvalidFieldValueValidationError' + https://hivemq.com/edge/api/model/InvalidIdentifierValidationError: '#/components/schemas/InvalidIdentifierValidationError' + https://hivemq.com/edge/api/model/MissingFieldValidationError: '#/components/schemas/MissingFieldValidationError' + https://hivemq.com/edge/api/model/UnsupportedFieldValidationError: '#/components/schemas/UnsupportedFieldValidationError' + SchemaInvalidErrors: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + - type: object + properties: + childErrors: + type: array + description: List of child validation errors. + items: + $ref: '#/components/schemas/SchemaValidationError' + required: + - childErrors + example: + general: + status: 400 + title: Schema Invalid + detail: Schema is invalid due to validation errors. + type: https://hivemq.com/edge/api/model/SchemaInvalidErrors + childErrors: + - detail: The length of script field '$.id' 1025 must be between 0 and 1024. + paths: $.id + value: aaa...aaa + actualLength: 1025 + expectedMinimumLength: 0 + expectedMaximumLength: 1024 + type: https://hivemq.com/edge/api/model/InvalidFieldLengthValidationError + SchemaNotFoundError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + - type: object + properties: + id: + type: string + description: The schema ID. + example: abc + required: + - id + example: + general: + status: 404 + title: Schema Not Found + detail: Schema with ID 'abc' is not found. + id: abc + type: https://hivemq.com/edge/api/model/SchemaNotFoundError + SchemaParsingFailureError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + - type: object + properties: + alias: + type: string + description: The schema alias. + example: abc + required: + - alias + example: + general: + status: 400 + title: Schema Parsing Failure + detail: The given schema 'abc' could not be parsed. + alias: abc + type: https://hivemq.com/edge/api/model/SchemaParsingFailureError + SchemaReferencedError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + - type: object + properties: + id: + type: string + description: The schema ID. + example: abc + required: + - id + example: + general: + status: 400 + title: Schema Referenced + detail: Schema with ID 'abc' is referenced. + id: abc + type: https://hivemq.com/edge/api/model/SchemaReferencedError + ScriptAlreadyPresentError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + - type: object + properties: + id: + type: string + description: The script id. + example: abc + required: + - id + example: + general: + status: 409 + title: Script Already Present + detail: The given script 'abc' is already present. + id: abc + type: https://hivemq.com/edge/api/model/ScriptAlreadyPresentError + ScriptCreationFailureError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + example: + general: + status: 400 + title: Script Creation Failure + detail: The given script could not be created. + type: https://hivemq.com/edge/api/model/ScriptCreationFailureError + ScriptEtagMismatchError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + - type: object + properties: + id: + type: string + description: The script id. + example: abc + eTag: + type: string + description: The eTag. + example: 33a64df551425fcc55e4d42a148795d9f25f89d4 + required: + - id + example: + general: + status: 412 + title: Script eTag Mismatch + detail: Script with id 'abc' does not match the given etag '33a64df551425fcc55e4d42a148795d9f25f89d4'. + id: abc + eTag: 33a64df551425fcc55e4d42a148795d9f25f89d4 + type: https://hivemq.com/edge/api/model/ScriptEtagMismatchError + ScriptInsufficientStorageError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + - type: object + properties: + id: + type: string + description: The policy id. + example: abc + required: + - id + example: + general: + status: 507 + title: Script Insufficient Storage + detail: Script with ID '123' could not be added because of insufficient server storage. + id: abc + type: https://hivemq.com/edge/api/model/ScriptInsufficientStorageError + ScriptValidationError: + allOf: + - $ref: '#/components/schemas/ValidationError' + - oneOf: + - $ref: '#/components/schemas/InvalidFieldLengthValidationError' + - $ref: '#/components/schemas/InvalidFieldValueValidationError' + - $ref: '#/components/schemas/InvalidIdentifierValidationError' + - $ref: '#/components/schemas/MissingFieldValidationError' + - $ref: '#/components/schemas/UnsupportedFieldValidationError' + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/InvalidFieldLengthValidationError: '#/components/schemas/InvalidFieldLengthValidationError' + https://hivemq.com/edge/api/model/InvalidFieldValueValidationError: '#/components/schemas/InvalidFieldValueValidationError' + https://hivemq.com/edge/api/model/InvalidIdentifierValidationError: '#/components/schemas/InvalidIdentifierValidationError' + https://hivemq.com/edge/api/model/MissingFieldValidationError: '#/components/schemas/MissingFieldValidationError' + https://hivemq.com/edge/api/model/UnsupportedFieldValidationError: '#/components/schemas/UnsupportedFieldValidationError' + ScriptInvalidErrors: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + - type: object + properties: + childErrors: + type: array + description: List of child validation errors. + items: + $ref: '#/components/schemas/ScriptValidationError' + required: + - childErrors + example: + general: + status: 400 + title: Script Invalid + detail: Script is invalid due to validation errors. + type: https://hivemq.com/edge/api/model/ScriptInvalidErrors + childErrors: + - detail: The length of script field '$.id' 1025 must be between 0 and 1024. + paths: $.id + value: aaa...aaa + actualLength: 1025 + expectedMinimumLength: 0 + expectedMaximumLength: 1024 + type: https://hivemq.com/edge/api/model/InvalidFieldLengthValidationError + ScriptNotFoundError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + - type: object + properties: + id: + type: string + description: The script ID. + example: abc + required: + - id + example: + general: + status: 404 + title: Script Not Found + detail: Script with ID 'abc' is not found. + id: abc + type: https://hivemq.com/edge/api/model/ScriptNotFoundError + ScriptParsingFailureError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + example: + general: + status: 400 + title: Script Parsing Failure + detail: The given script 'abc' could not be parsed. + type: https://hivemq.com/edge/api/model/ScriptParsingFailureError + ScriptReferencedError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + - type: object + properties: + id: + type: string + description: The script ID. + example: abc + required: + - id + example: + general: + status: 400 + title: Script Referenced + detail: Script with ID 'abc' is referenced. + id: abc + type: https://hivemq.com/edge/api/model/ScriptReferencedError + ScriptSanitationFailureError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + example: + general: + status: 400 + title: Script Sanitation Failure + detail: The given script could not be sanitized. + type: https://hivemq.com/edge/api/model/ScriptSanitationFailureError + TopicFilterMismatchError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + - type: object + properties: + path: + type: string + description: The json path of the topic filter. + example: $.filter + required: + - path + example: + general: + status: 400 + title: Topic Filter Mismatch + detail: The topic filter '$.filter' mismatches. + type: https://hivemq.com/edge/api/model/TopicFilterMismatchError + InsufficientStorageError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + example: + general: + status: 507 + title: Insufficient Storage + detail: Insufficient Storage. + type: https://hivemq.com/edge/api/model/InsufficientStorageError + InternalServerError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + example: + general: + status: 500 + title: Internal Server Error + detail: An unexpected error occurred, check the logs. + type: https://hivemq.com/edge/api/model/InternalServerError + creation: + status: 500 + title: Internal Server Error + detail: 'An unexpected error occurred: Exception during creation of the Json Schema for functions.' + type: https://hivemq.com/edge/api/model/InternalServerError + InvalidQueryParameterError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + - type: object + properties: + parameter: + type: string + description: The query parameter. + required: + - parameter + example: + general: + status: 400 + title: Query Parameter is Invalid + detail: 'Query parameter ''a'' is invalid: ''a'' could not be parsed.' + parameter: a + type: https://hivemq.com/edge/api/model/InvalidQueryParameterError + PreconditionFailedError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + example: + general: + status: 412 + title: Precondition Failed + detail: 'A precondition required for fulfilling the request was not fulfilled: Policy does not match the given etag ''abc''.' + type: https://hivemq.com/edge/api/model/PreconditionFailedError + RequestBodyMissingError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + example: + general: + status: 400 + title: Required Request Body Missing + detail: Required request body is missing. + type: https://hivemq.com/edge/api/model/RequestBodyMissingError + RequestBodyParameterMissingError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + - type: object + properties: + parameter: + type: string + description: The the missing request body parameter. + required: + - parameter + example: + general: + status: 400 + title: Required Request Body Parameter Missing + detail: Required request body parameter 'a' is missing. + parameter: a + type: https://hivemq.com/edge/api/model/RequestBodyParameterMissingError + TemporaryNotAvailableError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + example: + general: + status: 503 + title: Endpoint Temporarily not Available + detail: The endpoint is temporarily not available, please try again later. + type: https://hivemq.com/edge/api/model/TemporaryNotAvailableError + UrlParameterMissingError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + - type: object + properties: + parameter: + type: string + description: The name of the missing parameter. + required: + - parameter + example: + general: + status: 400 + title: Required URL Parameter Missing + detail: Required URL parameter 'a' is missing. + parameter: a + type: https://hivemq.com/edge/api/model/UrlParameterMissingError + JsonNode: + type: object + description: The arguments of the fsm derived from the behavior policy. + FsmStateInformationItem: + type: object + description: List of result items that are returned by this endpoint + properties: + arguments: + $ref: '#/components/schemas/JsonNode' + behaviorId: + type: string + description: The unique identifier of the policy. + firstSetAt: + type: string + description: The timestamp when this state was set the first time. + policyId: + type: string + description: The unique identifier of the policy. + stateName: type: string description: The name of the fsm state. stateType: @@ -5153,8 +6602,6 @@ components: description: List of result items that are returned by this endpoint items: $ref: '#/components/schemas/DataPolicy' - Errors: - type: object PolicyType: description: The type of policy in Data Hub type: string diff --git a/ext/hivemq-edge-openapi-2025.15.yaml b/ext/hivemq-edge-openapi-2025.15.yaml index bb996cf852..16b9ba5dfb 100644 --- a/ext/hivemq-edge-openapi-2025.15.yaml +++ b/ext/hivemq-edge-openapi-2025.15.yaml @@ -14,7 +14,7 @@ info: ## OpenAPI HiveMQ's REST API provides an OpenAPI 3.0 schema definition that can imported into popular API tooling (e.g. Postman) or can be used to generate client-code for multiple programming languages. title: HiveMQ Edge REST API - version: 2025.14-SNAPSHOT + version: 2025.15-SNAPSHOT x-logo: url: https://www.hivemq.com/img/svg/hivemq-bee.svg tags: @@ -357,12 +357,23 @@ paths: schema: $ref: '#/components/schemas/BehaviorPolicyList' description: Success + '400': + content: + application/problem+json: + schema: + oneOf: + - $ref: '#/components/schemas/InvalidQueryParameterError' + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/InvalidQueryParameterError: '#/components/schemas/InvalidQueryParameterError' + description: URL parameter missing '503': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' - description: Temporarily not available + $ref: '#/components/schemas/TemporaryNotAvailableError' + description: Request resource temporary unavailable summary: Get all policies tags: - Data Hub - Behavior Policies @@ -447,34 +458,45 @@ paths: description: Success '400': content: - application/json: - schema: - $ref: '#/components/schemas/ProblemDetails' + application/problem+json: + schema: + oneOf: + - $ref: '#/components/schemas/BehaviorPolicyCreationFailureError' + - $ref: '#/components/schemas/BehaviorPolicyInvalidErrors' + - $ref: '#/components/schemas/BehaviorPolicyRejectedError' + - $ref: '#/components/schemas/RequestBodyMissingError' + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/BehaviorPolicyCreationFailureError: '#/components/schemas/BehaviorPolicyCreationFailureError' + https://hivemq.com/edge/api/model/BehaviorPolicyInvalidErrors: '#/components/schemas/BehaviorPolicyInvalidErrors' + https://hivemq.com/edge/api/model/BehaviorPolicyRejectedError: '#/components/schemas/BehaviorPolicyRejectedError' + https://hivemq.com/edge/api/model/RequestBodyMissingError: '#/components/schemas/RequestBodyMissingError' description: Policy creation failed '409': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' - description: Already exists + $ref: '#/components/schemas/BehaviorPolicyAlreadyPresentError' + description: Behavior policy already present '500': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' - description: Internal error + $ref: '#/components/schemas/InternalServerError' + description: Internal server error '503': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' - description: Temporarily unavailable + $ref: '#/components/schemas/TemporaryNotAvailableError' + description: Request resource temporary unavailable '507': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' - description: Insufficient storage error + $ref: '#/components/schemas/PolicyInsufficientStorageError' + description: Insufficient storage summary: Create a new policy tags: - Data Hub - Behavior Policies @@ -504,34 +526,39 @@ paths: description: Success, no response body '400': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + oneOf: + - $ref: '#/components/schemas/UrlParameterMissingError' + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/UrlParameterMissingError: '#/components/schemas/UrlParameterMissingError' description: URL parameter missing '404': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' - description: Policy not found + $ref: '#/components/schemas/PolicyNotFoundError' + description: Behavior policy not found '412': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/PreconditionFailedError' description: Precondition failed '500': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' - description: Internal error + $ref: '#/components/schemas/InternalServerError' + description: Internal server error '503': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' - description: Temporarily not available + $ref: '#/components/schemas/TemporaryNotAvailableError' + description: Request resource temporary unavailable summary: Delete a behavior policy tags: - Data Hub - Behavior Policies @@ -599,16 +626,33 @@ paths: description: Success '400': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' - description: Invalid query parameter + oneOf: + - $ref: '#/components/schemas/UrlParameterMissingError' + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/UrlParameterMissingError: '#/components/schemas/UrlParameterMissingError' + description: Bad request '404': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/BehaviorPolicyNotFoundError' description: Policy not found + '500': + content: + application/problem+json: + schema: + $ref: '#/components/schemas/InternalServerError' + description: Internal server error + '503': + content: + application/problem+json: + schema: + $ref: '#/components/schemas/TemporaryNotAvailableError' + description: Request resource temporary unavailable summary: Get a policy tags: - Data Hub - Behavior Policies @@ -709,41 +753,56 @@ paths: description: Success '400': content: - application/json: - schema: - $ref: '#/components/schemas/ProblemDetails' - description: Policy creation failed + application/problem+json: + schema: + oneOf: + - $ref: '#/components/schemas/RequestBodyMissingError' + - $ref: '#/components/schemas/UrlParameterMissingError' + - $ref: '#/components/schemas/BehaviorPolicyCreationFailureError' + - $ref: '#/components/schemas/BehaviorPolicyInvalidErrors' + - $ref: '#/components/schemas/BehaviorPolicyUpdateFailureError' + - $ref: '#/components/schemas/PolicyIdMismatchError' + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/RequestBodyMissingError: '#/components/schemas/RequestBodyMissingError' + https://hivemq.com/edge/api/model/UrlParameterMissingError: '#/components/schemas/UrlParameterMissingError' + https://hivemq.com/edge/api/model/BehaviorPolicyCreationFailureError: '#/components/schemas/BehaviorPolicyCreationFailureError' + https://hivemq.com/edge/api/model/BehaviorPolicyInvalidErrors: '#/components/schemas/BehaviorPolicyInvalidErrors' + https://hivemq.com/edge/api/model/BehaviorPolicyUpdateFailureError: '#/components/schemas/BehaviorPolicyUpdateFailureError' + https://hivemq.com/edge/api/model/PolicyIdMismatchError: '#/components/schemas/PolicyIdMismatchError' + description: Behavior policy creation failed '404': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' - description: Policy not found + $ref: '#/components/schemas/BehaviorPolicyNotFoundError' + description: Data policy not found '412': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/PreconditionFailedError' description: Precondition failed '500': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' - description: Internal error + $ref: '#/components/schemas/InternalServerError' + description: Internal server error '503': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' - description: Temporarily unavailable + $ref: '#/components/schemas/TemporaryNotAvailableError' + description: Request resource temporary unavailable '507': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' - description: Insufficient storage error - summary: Update an existing policy + $ref: '#/components/schemas/PolicyInsufficientStorageError' + description: Insufficient storage + summary: Update an existing behavior policy tags: - Data Hub - Behavior Policies /api/v1/data-hub/behavior-validation/states/{clientId}: @@ -787,22 +846,34 @@ paths: description: Success '400': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + oneOf: + - $ref: '#/components/schemas/UrlParameterMissingError' + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/UrlParameterMissingError: '#/components/schemas/UrlParameterMissingError' description: URL parameter missing '404': content: - application/json: - schema: - $ref: '#/components/schemas/ProblemDetails' - description: Client is disconnected + application/problem+json: + schema: + oneOf: + - $ref: '#/components/schemas/ClientDisconnectedError' + - $ref: '#/components/schemas/ClientNotFoundError' + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/ClientDisconnectedError: '#/components/schemas/ClientDisconnectedError' + https://hivemq.com/edge/api/model/ClientNotFoundError: '#/components/schemas/ClientNotFoundError' + description: Client error '500': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' - description: Internal Server error + $ref: '#/components/schemas/InternalServerError' + description: Internal server error summary: Get the state of a client tags: - Data Hub - State @@ -1051,27 +1122,20 @@ paths: description: Success '400': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + oneOf: + - $ref: '#/components/schemas/InvalidQueryParameterError' + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/InvalidQueryParameterError: '#/components/schemas/InvalidQueryParameterError' description: URL parameter missing - '404': - content: - application/json: - schema: - $ref: '#/components/schemas/ProblemDetails' - description: DataPolicy not found - '500': - content: - application/json: - schema: - $ref: '#/components/schemas/ProblemDetails' - description: Internal server error '503': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/TemporaryNotAvailableError' description: Request resource temporary unavailable summary: Get all data policies tags: @@ -1155,33 +1219,44 @@ paths: description: Success '400': content: - application/json: - schema: - $ref: '#/components/schemas/ProblemDetails' - description: DataPolicy creation failed + application/problem+json: + schema: + oneOf: + - $ref: '#/components/schemas/RequestBodyMissingError' + - $ref: '#/components/schemas/DataPolicyCreationFailureError' + - $ref: '#/components/schemas/DataPolicyInvalidErrors' + - $ref: '#/components/schemas/DataPolicyRejectedError' + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/RequestBodyMissingError: '#/components/schemas/RequestBodyMissingError' + https://hivemq.com/edge/api/model/DataPolicyCreationFailureError: '#/components/schemas/DataPolicyCreationFailureError' + https://hivemq.com/edge/api/model/DataPolicyInvalidErrors: '#/components/schemas/DataPolicyInvalidErrors' + https://hivemq.com/edge/api/model/DataPolicyRejectedError: '#/components/schemas/DataPolicyRejectedError' + description: Data policy creation failed '409': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' - description: DataPolicy already present + $ref: '#/components/schemas/DataPolicyAlreadyPresentError' + description: Data policy already present '500': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/InternalServerError' description: Internal server error '503': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/TemporaryNotAvailableError' description: Request resource temporary unavailable '507': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/PolicyInsufficientStorageError' description: Insufficient storage summary: Create a new data policy tags: @@ -1212,27 +1287,38 @@ paths: description: Success, no response body '400': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + oneOf: + - $ref: '#/components/schemas/UrlParameterMissingError' + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/UrlParameterMissingError: '#/components/schemas/UrlParameterMissingError' description: URL parameter missing '404': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' - description: DataPolicy not found + $ref: '#/components/schemas/PolicyNotFoundError' + description: Data policy not found + '412': + content: + application/problem+json: + schema: + $ref: '#/components/schemas/PreconditionFailedError' + description: Precondition failed '500': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/InternalServerError' description: Internal server error '503': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/TemporaryNotAvailableError' description: Request resource temporary unavailable summary: Delete a data policy tags: @@ -1300,32 +1386,33 @@ paths: description: Success '400': content: - application/json: - examples: - param-missing: - description: Example response when a required parameter is missing. - summary: Required URL parameter missing - value: - errors: - - title: Required parameter missing - detail: Required URL parameter 'parameterName' is missing + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + oneOf: + - $ref: '#/components/schemas/UrlParameterMissingError' + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/UrlParameterMissingError: '#/components/schemas/UrlParameterMissingError' description: Bad request '404': content: - application/json: - examples: - not-found: - description: Policy not found - summary: Not found - value: - errors: - - title: Resource not found - detail: Resource with id 'my-resource-id' not found + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/PolicyNotFoundError' description: Resource not found + '500': + content: + application/problem+json: + schema: + $ref: '#/components/schemas/InternalServerError' + description: Internal server error + '503': + content: + application/problem+json: + schema: + $ref: '#/components/schemas/TemporaryNotAvailableError' + description: Request resource temporary unavailable summary: Get a data policy tags: - Data Hub - Data Policies @@ -1425,33 +1512,56 @@ paths: description: Success '400': content: - application/json: - schema: - $ref: '#/components/schemas/ProblemDetails' - description: DataPolicy creation failed + application/problem+json: + schema: + oneOf: + - $ref: '#/components/schemas/RequestBodyMissingError' + - $ref: '#/components/schemas/UrlParameterMissingError' + - $ref: '#/components/schemas/DataPolicyCreationFailureError' + - $ref: '#/components/schemas/DataPolicyInvalidErrors' + - $ref: '#/components/schemas/DataPolicyUpdateFailureError' + - $ref: '#/components/schemas/PolicyIdMismatchError' + - $ref: '#/components/schemas/TopicFilterMismatchError' + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/RequestBodyMissingError: '#/components/schemas/RequestBodyMissingError' + https://hivemq.com/edge/api/model/UrlParameterMissingError: '#/components/schemas/UrlParameterMissingError' + https://hivemq.com/edge/api/model/DataPolicyCreationFailureError: '#/components/schemas/DataPolicyCreationFailureError' + https://hivemq.com/edge/api/model/DataPolicyInvalidErrors: '#/components/schemas/DataPolicyInvalidErrors' + https://hivemq.com/edge/api/model/DataPolicyUpdateFailureError: '#/components/schemas/DataPolicyUpdateFailureError' + https://hivemq.com/edge/api/model/PolicyIdMismatchError: '#/components/schemas/PolicyIdMismatchError' + https://hivemq.com/edge/api/model/TopicFilterMismatchError: '#/components/schemas/TopicFilterMismatchError' + description: Data policy creation failed '404': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' - description: DataPolicy not found + $ref: '#/components/schemas/DataPolicyNotFoundError' + description: Data policy not found + '412': + content: + application/problem+json: + schema: + $ref: '#/components/schemas/PreconditionFailedError' + description: Precondition failed '500': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/InternalServerError' description: Internal server error '503': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/TemporaryNotAvailableError' description: Request resource temporary unavailable '507': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/PolicyInsufficientStorageError' description: Insufficient storage summary: Update an existing data policy tags: @@ -1537,9 +1647,9 @@ paths: description: Success '500': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/Errors' + $ref: '#/components/schemas/InternalServerError' description: Internal server error summary: Get all FSMs as a JSON Schema tags: @@ -1699,9 +1809,9 @@ paths: description: Success '500': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/InternalServerError' description: Internal server error summary: Get all functions as a JSON Schema tags: @@ -1719,9 +1829,9 @@ paths: description: Success '500': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/InternalServerError' description: Internal server error summary: Get all interpolation variables tags: @@ -1739,9 +1849,9 @@ paths: description: Success '500': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/InternalServerError' description: Internal server error summary: Get all functions as a list of function specifications tags: @@ -1876,11 +1986,22 @@ paths: schema: $ref: '#/components/schemas/SchemaList' description: Success + '400': + content: + application/problem+json: + schema: + oneOf: + - $ref: '#/components/schemas/InvalidQueryParameterError' + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/InvalidQueryParameterError: '#/components/schemas/InvalidQueryParameterError' + description: URL parameter missing '503': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/TemporaryNotAvailableError' description: Request resource temporary unavailable summary: Get all schemas tags: @@ -1927,33 +2048,48 @@ paths: description: Success '400': content: - application/json: - schema: - $ref: '#/components/schemas/ProblemDetails' - description: Schema could not be validatetd + application/problem+json: + schema: + oneOf: + - $ref: '#/components/schemas/RequestBodyParameterMissingError' + - $ref: '#/components/schemas/SchemaInvalidErrors' + - $ref: '#/components/schemas/SchemaParsingFailureError' + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/RequestBodyParameterMissingError: '#/components/schemas/RequestBodyParameterMissingError' + https://hivemq.com/edge/api/model/SchemaInvalidErrors: '#/components/schemas/SchemaInvalidErrors' + https://hivemq.com/edge/api/model/SchemaParsingFailureError: '#/components/schemas/SchemaParsingFailureError' + description: Schema creation failed '409': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' - description: Schema already exists + $ref: '#/components/schemas/SchemaAlreadyPresentError' + description: Schema is already present '412': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' - description: Mismatch between schema and etag + $ref: '#/components/schemas/SchemaEtagMismatchError' + description: Schema doesn't match etag '500': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/InternalServerError' description: Internal server error + '503': + content: + application/problem+json: + schema: + $ref: '#/components/schemas/TemporaryNotAvailableError' + description: Request resource temporary unavailable '507': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/SchemaInsufficientStorageError' description: Insufficient storage summary: Create a new schema tags: @@ -1984,33 +2120,40 @@ paths: description: Success, no response body '400': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' - description: Schema referenced + oneOf: + - $ref: '#/components/schemas/UrlParameterMissingError' + - $ref: '#/components/schemas/SchemaReferencedError' + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/UrlParameterMissingError: '#/components/schemas/UrlParameterMissingError' + https://hivemq.com/edge/api/model/SchemaReferencedError: '#/components/schemas/SchemaReferencedError' + description: URL parameter missing '404': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/SchemaNotFoundError' description: Schema not found '412': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' - description: Mismatch between schema and etag + $ref: '#/components/schemas/SchemaEtagMismatchError' + description: Schema doesn't match etag '500': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' - description: Internal server error + $ref: '#/components/schemas/InternalServerError' + description: Internal Server error '503': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/TemporaryNotAvailableError' description: Request resource temporary unavailable summary: Delete all versions of the schema tags: @@ -2056,22 +2199,33 @@ paths: description: Success '400': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' - description: A url parameter is missing + oneOf: + - $ref: '#/components/schemas/UrlParameterMissingError' + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/UrlParameterMissingError: '#/components/schemas/UrlParameterMissingError' + description: URL parameter missing '404': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/SchemaNotFoundError' description: Schema not found '500': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/InternalServerError' description: Internal server error + '503': + content: + application/problem+json: + schema: + $ref: '#/components/schemas/TemporaryNotAvailableError' + description: Request resource temporary unavailable summary: Get a schema tags: - Data Hub - Schemas @@ -2192,12 +2346,23 @@ paths: schema: $ref: '#/components/schemas/ScriptList' description: Success + '400': + content: + application/problem+json: + schema: + oneOf: + - $ref: '#/components/schemas/InvalidQueryParameterError' + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/InvalidQueryParameterError: '#/components/schemas/InvalidQueryParameterError' + description: URL parameter missing '503': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' - description: Temporary not available + $ref: '#/components/schemas/TemporaryNotAvailableError' + description: Request resource temporary unavailable summary: Get all scripts tags: - Data Hub - Scripts @@ -2243,39 +2408,52 @@ paths: description: Success '400': content: - application/json: - schema: - $ref: '#/components/schemas/ProblemDetails' - description: Script is invalid + application/problem+json: + schema: + oneOf: + - $ref: '#/components/schemas/RequestBodyParameterMissingError' + - $ref: '#/components/schemas/ScriptCreationFailureError' + - $ref: '#/components/schemas/ScriptInvalidErrors' + - $ref: '#/components/schemas/ScriptParsingFailureError' + - $ref: '#/components/schemas/ScriptSanitationFailureError' + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/RequestBodyParameterMissingError: '#/components/schemas/RequestBodyParameterMissingError' + https://hivemq.com/edge/api/model/ScriptCreationFailureError: '#/components/schemas/ScriptCreationFailureError' + https://hivemq.com/edge/api/model/ScriptInvalidErrors: '#/components/schemas/ScriptInvalidErrors' + https://hivemq.com/edge/api/model/ScriptParsingFailureError: '#/components/schemas/ScriptParsingFailureError' + https://hivemq.com/edge/api/model/ScriptSanitationFailureError: '#/components/schemas/ScriptSanitationFailureError' + description: Script creation failed '409': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/ScriptAlreadyPresentError' description: Script is already present '412': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/ScriptEtagMismatchError' description: Script doesn't match etag '500': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/InternalServerError' description: Internal server error '503': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' - description: Temporary not available + $ref: '#/components/schemas/TemporaryNotAvailableError' + description: Request resource temporary unavailable '507': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/ScriptInsufficientStorageError' description: Insufficient storage summary: Create a new script tags: @@ -2303,34 +2481,41 @@ paths: description: Success, no response body '400': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' - description: Script is referenced + oneOf: + - $ref: '#/components/schemas/UrlParameterMissingError' + - $ref: '#/components/schemas/ScriptReferencedError' + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/UrlParameterMissingError: '#/components/schemas/UrlParameterMissingError' + https://hivemq.com/edge/api/model/ScriptReferencedError: '#/components/schemas/ScriptReferencedError' + description: URL parameter missing '404': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/ScriptNotFoundError' description: Script not found '412': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/ScriptEtagMismatchError' description: Script doesn't match etag '500': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/InternalServerError' description: Internal Server error '503': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' - description: Temporary not available + $ref: '#/components/schemas/TemporaryNotAvailableError' + description: Request resource temporary unavailable summary: Delete a script tags: - Data Hub - Scripts @@ -2371,28 +2556,33 @@ paths: description: Success '400': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + oneOf: + - $ref: '#/components/schemas/UrlParameterMissingError' + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/UrlParameterMissingError: '#/components/schemas/UrlParameterMissingError' description: URL parameter missing '404': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/ScriptNotFoundError' description: Script not found '500': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/InternalServerError' description: Internal Server error '503': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' - description: Temporary not available + $ref: '#/components/schemas/TemporaryNotAvailableError' + description: Request resource temporary unavailable summary: Get a script tags: - Data Hub - Scripts @@ -4916,6 +5106,7 @@ components: detail: type: string errors: + deprecated: true type: array items: $ref: '#/components/schemas/Error' @@ -5080,25 +5271,1283 @@ components: description: List of result items that are returned by this endpoint items: $ref: '#/components/schemas/BehaviorPolicy' - JsonNode: - type: object - description: The arguments of the fsm derived from the behavior policy. - FsmStateInformationItem: - type: object - description: List of result items that are returned by this endpoint - properties: - arguments: - $ref: '#/components/schemas/JsonNode' - behaviorId: - type: string - description: The unique identifier of the policy. - firstSetAt: - type: string - description: The timestamp when this state was set the first time. - policyId: - type: string - description: The unique identifier of the policy. - stateName: + ApiProblemDetails: + allOf: + - $ref: '#/components/schemas/ProblemDetails' + - type: object + required: + - detail + - status + - type + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/BehaviorPolicyAlreadyPresentError: '#/components/schemas/BehaviorPolicyAlreadyPresentError' + https://hivemq.com/edge/api/model/BehaviorPolicyCreationFailureError: '#/components/schemas/BehaviorPolicyCreationFailureError' + https://hivemq.com/edge/api/model/BehaviorPolicyInvalidErrors: '#/components/schemas/BehaviorPolicyInvalidErrors' + https://hivemq.com/edge/api/model/BehaviorPolicyNotFoundError: '#/components/schemas/BehaviorPolicyNotFoundError' + https://hivemq.com/edge/api/model/BehaviorPolicyRejectedError: '#/components/schemas/BehaviorPolicyRejectedError' + https://hivemq.com/edge/api/model/BehaviorPolicyUpdateFailureError: '#/components/schemas/BehaviorPolicyUpdateFailureError' + https://hivemq.com/edge/api/model/ClientDisconnectedError: '#/components/schemas/ClientDisconnectedError' + https://hivemq.com/edge/api/model/ClientNotFoundError: '#/components/schemas/ClientNotFoundError' + https://hivemq.com/edge/api/model/DataPolicyAlreadyPresentError: '#/components/schemas/DataPolicyAlreadyPresentError' + https://hivemq.com/edge/api/model/DataPolicyCreationFailureError: '#/components/schemas/DataPolicyCreationFailureError' + https://hivemq.com/edge/api/model/DataPolicyInvalidErrors: '#/components/schemas/DataPolicyInvalidErrors' + https://hivemq.com/edge/api/model/DataPolicyNotFoundError: '#/components/schemas/DataPolicyNotFoundError' + https://hivemq.com/edge/api/model/DataPolicyRejectedError: '#/components/schemas/DataPolicyRejectedError' + https://hivemq.com/edge/api/model/DataPolicyUpdateFailureError: '#/components/schemas/DataPolicyUpdateFailureError' + https://hivemq.com/edge/api/model/PolicyIdMismatchError: '#/components/schemas/PolicyIdMismatchError' + https://hivemq.com/edge/api/model/PolicyInsufficientStorageError: '#/components/schemas/PolicyInsufficientStorageError' + https://hivemq.com/edge/api/model/PolicyNotFoundError: '#/components/schemas/PolicyNotFoundError' + https://hivemq.com/edge/api/model/SchemaAlreadyPresentError: '#/components/schemas/SchemaAlreadyPresentError' + https://hivemq.com/edge/api/model/SchemaEtagMismatchError: '#/components/schemas/SchemaEtagMismatchError' + https://hivemq.com/edge/api/model/SchemaInsufficientStorageError: '#/components/schemas/SchemaInsufficientStorageError' + https://hivemq.com/edge/api/model/SchemaInvalidErrors: '#/components/schemas/SchemaInvalidErrors' + https://hivemq.com/edge/api/model/SchemaNotFoundError: '#/components/schemas/SchemaNotFoundError' + https://hivemq.com/edge/api/model/SchemaParsingFailureError: '#/components/schemas/SchemaParsingFailureError' + https://hivemq.com/edge/api/model/SchemaReferencedError: '#/components/schemas/SchemaReferencedError' + https://hivemq.com/edge/api/model/ScriptAlreadyPresentError: '#/components/schemas/ScriptAlreadyPresentError' + https://hivemq.com/edge/api/model/ScriptCreationFailureError: '#/components/schemas/ScriptCreationFailureError' + https://hivemq.com/edge/api/model/ScriptEtagMismatchError: '#/components/schemas/ScriptEtagMismatchError' + https://hivemq.com/edge/api/model/ScriptInsufficientStorageError: '#/components/schemas/ScriptInsufficientStorageError' + https://hivemq.com/edge/api/model/ScriptInvalidErrors: '#/components/schemas/ScriptInvalidErrors' + https://hivemq.com/edge/api/model/ScriptNotFoundError: '#/components/schemas/ScriptNotFoundError' + https://hivemq.com/edge/api/model/ScriptParsingFailureError: '#/components/schemas/ScriptParsingFailureError' + https://hivemq.com/edge/api/model/ScriptReferencedError: '#/components/schemas/ScriptReferencedError' + https://hivemq.com/edge/api/model/ScriptSanitationFailureError: '#/components/schemas/ScriptSanitationFailureError' + https://hivemq.com/edge/api/model/TopicFilterMismatchError: '#/components/schemas/TopicFilterMismatchError' + https://hivemq.com/edge/api/model/InsufficientStorageError: '#/components/schemas/InsufficientStorageError' + https://hivemq.com/edge/api/model/InternalServerError: '#/components/schemas/InternalServerError' + https://hivemq.com/edge/api/model/InvalidQueryParameterError: '#/components/schemas/InvalidQueryParameterError' + https://hivemq.com/edge/api/model/PreconditionFailedError: '#/components/schemas/PreconditionFailedError' + https://hivemq.com/edge/api/model/RequestBodyMissingError: '#/components/schemas/RequestBodyMissingError' + https://hivemq.com/edge/api/model/RequestBodyParameterMissingError: '#/components/schemas/RequestBodyParameterMissingError' + https://hivemq.com/edge/api/model/TemporaryNotAvailableError: '#/components/schemas/TemporaryNotAvailableError' + https://hivemq.com/edge/api/model/UrlParameterMissingError: '#/components/schemas/UrlParameterMissingError' + BehaviorPolicyAlreadyPresentError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + - type: object + properties: + id: + type: string + description: The behavior policy id. + example: abc + required: + - id + example: + general: + status: 409 + title: Behavior Policy Already Present + detail: The given behavior policy 'abc' is already present. + id: abc + type: https://hivemq.com/edge/api/model/BehaviorPolicyAlreadyPresentError + BehaviorPolicyCreationFailureError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + example: + general: + status: 400 + title: Behavior Policy Creation Failed + detail: 'Behavior policy creation failed: The policy was rejected.' + type: https://hivemq.com/edge/api/model/BehaviorPolicyCreationFailureError + AtLeastOneFieldMissingValidationError: + allOf: + - $ref: '#/components/schemas/ValidationError' + - type: object + properties: + paths: + type: array + description: The missing json paths. + items: + type: string + format: json-path + description: The json path. + example: + - $.field1 + - $.field2 + required: + - paths + example: + general: + detail: 'At least one of the fields must be present: ''$.field1'', ''$.field2''.' + paths: + - $.field1 + - $.field2 + type: https://hivemq.com/edge/api/model/AtLeastOneFieldMissingValidationError + ValidationError: + type: object + properties: + detail: + type: string + description: Detailed contextual description of the validation error. + type: + type: string + format: uri + description: Type of the validation error. + required: + - detail + - type + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/AtLeastOneFieldMissingValidationError: '#/components/schemas/AtLeastOneFieldMissingValidationError' + https://hivemq.com/edge/api/model/AtMostOneFunctionValidationError: '#/components/schemas/AtMostOneFunctionValidationError' + https://hivemq.com/edge/api/model/EmptyFieldValidationError: '#/components/schemas/EmptyFieldValidationError' + https://hivemq.com/edge/api/model/FunctionMustBePairedValidationError: '#/components/schemas/FunctionMustBePairedValidationError' + https://hivemq.com/edge/api/model/IllegalEventTransitionValidationError: '#/components/schemas/IllegalEventTransitionValidationError' + https://hivemq.com/edge/api/model/IllegalFunctionValidationError: '#/components/schemas/IllegalFunctionValidationError' + https://hivemq.com/edge/api/model/InvalidFieldLengthValidationError: '#/components/schemas/InvalidFieldLengthValidationError' + https://hivemq.com/edge/api/model/InvalidFieldValueValidationError: '#/components/schemas/InvalidFieldValueValidationError' + https://hivemq.com/edge/api/model/InvalidFunctionOrderValidationError: '#/components/schemas/InvalidFunctionOrderValidationError' + https://hivemq.com/edge/api/model/InvalidIdentifierValidationError: '#/components/schemas/InvalidIdentifierValidationError' + https://hivemq.com/edge/api/model/InvalidSchemaVersionValidationError: '#/components/schemas/InvalidSchemaVersionValidationError' + https://hivemq.com/edge/api/model/MissingFieldValidationError: '#/components/schemas/MissingFieldValidationError' + https://hivemq.com/edge/api/model/UnknownVariableValidationError: '#/components/schemas/UnknownVariableValidationError' + https://hivemq.com/edge/api/model/UnsupportedFieldValidationError: '#/components/schemas/UnsupportedFieldValidationError' + AtMostOneFunctionValidationError: + allOf: + - $ref: '#/components/schemas/ValidationError' + - type: object + properties: + function: + type: string + description: The function. + example: function1 + occurrences: + type: integer + format: int32 + description: The occurrences of the function. + minimum: 0 + example: 3 + paths: + type: array + items: + type: string + format: json-path + description: The json paths where the function occurs. + example: + - $.path1 + - $.path2 + - $.path3 + required: + - function + - occurrences + - paths + example: + general: + detail: The pipeline must contain at most one 'function1' function, but 3 were found at ['$.path1', '$.path2', '$.path3']. + function: function1 + occurrences: 3 + paths: + - $.path1 + - $.path2 + - $.path3 + type: https://hivemq.com/edge/api/model/AtMostOneFunctionValidationError + EmptyFieldValidationError: + allOf: + - $ref: '#/components/schemas/ValidationError' + - type: object + properties: + path: + type: string + format: json-path + description: The missing field. + example: $.field + required: + - path + example: + general: + detail: Required field '$.field' is empty. + path: $.field + type: https://hivemq.com/edge/api/model/EmptyFieldValidationError + FunctionMustBePairedValidationError: + allOf: + - $ref: '#/components/schemas/ValidationError' + - type: object + properties: + existingFunction: + type: string + description: The existing function. + example: function1 + missingFunction: + type: string + description: The missing function. + example: function2 + required: + - existingFunction + - missingFunction + example: + general: + detail: If 'function1' function is present in the pipeline, 'function2' function must be present as well. + existingFunction: function1 + missingFunction: function2 + type: https://hivemq.com/edge/api/model/FunctionMustBePairedValidationError + IllegalEventTransitionValidationError: + allOf: + - $ref: '#/components/schemas/ValidationError' + - type: object + properties: + event: + type: string + description: The event name. + example: event1 + fromState: + type: string + description: The event from state. + example: state1 + id: + type: string + description: The event id. + example: abc + path: + type: string + description: The path. + example: $.event + toState: + type: string + description: The event to state. + example: state2 + required: + - event + - fromState + - id + - path + - toState + example: + general: + detail: The transition from state 'state1' to state 'state2' on event 'event1' in '$.event' is not defined for behavior 'abc'. + event: event1 + fromState: state1 + toState: state2 + id: abc + path: $.event + type: https://hivemq.com/edge/api/model/IllegalEventTransitionValidationError + IllegalFunctionValidationError: + allOf: + - $ref: '#/components/schemas/ValidationError' + - type: object + properties: + event: + type: string + description: The event name. + example: event1 + id: + type: string + description: The function id. + example: abc + path: + type: string + format: json-path + description: The json path. + example: $.event + required: + - event + - id + - path + example: + general: + detail: The function 'abc' is not allowed for event 'event1' in '$.event'. + event: event1 + id: abc + path: $.event + type: https://hivemq.com/edge/api/model/IllegalFunctionValidationError + InvalidFieldLengthValidationError: + allOf: + - $ref: '#/components/schemas/ValidationError' + - type: object + properties: + actualLength: + type: integer + format: int32 + description: The actual length of the field value. + example: 10 + expectedMinimumLength: + type: integer + format: int32 + description: The minimum length expected for the field value. + minimum: 0 + example: 5 + expectedMaximumLength: + type: integer + format: int32 + description: The maximum length expected for the field value. + minimum: 0 + example: 20 + path: + type: string + format: json-path + description: The invalid json path. + example: $.field + value: + type: string + description: The invalid value. + example: function transform() { return 'Hello, World!'; } + required: + - actualLength + - expectedMinimumLength + - expectedMaximumLength + - path + - value + example: + general: + detail: The length of script field '$.transform' 48 must be between 0 and 20. + actualLength: 48 + minimumLength: 0 + maximumLength: 20 + path: $.transform + value: function transform() { return 'Hello, World!'; } + type: https://hivemq.com/edge/api/model/InvalidFieldLengthValidationError + InvalidFieldValueValidationError: + allOf: + - $ref: '#/components/schemas/ValidationError' + - type: object + properties: + path: + type: string + format: json-path + description: The invalid json path. + example: $.action.pipeline[1].field + value: + type: string + description: The invalid value. + example: functionDoesNotExist + required: + - path + example: + general: + detail: Referenced function does not exist. + path: $.action.pipeline[1].field + value: functionDoesNotExist + type: https://hivemq.com/edge/api/model/InvalidFieldValueValidationError + InvalidFunctionOrderValidationError: + allOf: + - $ref: '#/components/schemas/ValidationError' + - type: object + properties: + function: + type: string + description: The function. + example: transform + path: + type: string + format: json-path + description: The json path. + example: $.path + previousFunction: + type: string + description: The previous function. + example: init + required: + - function + - path + - previousFunction + example: + general: + detail: The operation at '$.path' with the functionId 'transform' must be after a 'init' operation. + function: transform + path: $.path + previousFunction: init + type: https://hivemq.com/edge/api/model/InvalidFunctionOrderValidationError + InvalidIdentifierValidationError: + allOf: + - $ref: '#/components/schemas/ValidationError' + - type: object + properties: + path: + type: string + format: json-path + description: The invalid identifier path. + example: $.id + value: + type: string + description: The invalid identifier value. + example: invalidId + required: + - path + - value + example: + general: + detail: Identifier script 'id' must begin with a letter and may only consist of lowercase letters, uppercase letters, numbers, periods, hyphens, and underscores. + path: $.id + value: invalidId + type: https://hivemq.com/edge/api/model/InvalidIdentifierValidationError + InvalidSchemaVersionValidationError: + allOf: + - $ref: '#/components/schemas/ValidationError' + - type: object + properties: + id: + type: string + description: The schema id. + example: abc + version: + type: string + description: The schema version. + example: '2' + required: + - id + - version + example: + general: + detail: The referenced schema with id 'abc' and version '2' was not found. + id: abc + version: '2' + type: https://hivemq.com/edge/api/model/InvalidSchemaVersionValidationError + MissingFieldValidationError: + allOf: + - $ref: '#/components/schemas/ValidationError' + - type: object + properties: + path: + type: string + format: json-path + description: The missing path. + example: $.id + required: + - path + example: + general: + detail: Required field '$.id' is missing. + path: $.id + type: https://hivemq.com/edge/api/model/MissingFieldValidationError + UnknownVariableValidationError: + allOf: + - $ref: '#/components/schemas/ValidationError' + - type: object + properties: + path: + type: string + description: The json path of the field. + example: $.path + variables: + type: array + items: + type: string + description: The unknown variables. + example: + - a + - b + - c + required: + - path + - variables + example: + general: + detail: 'Field ''$.path'' contains unknown variables: [a, b, c].' + path: $.path + variables: + - a + - b + - c + type: https://hivemq.com/edge/api/model/UnknownVariableValidationError + UnsupportedFieldValidationError: + allOf: + - $ref: '#/components/schemas/ValidationError' + - type: object + properties: + actualValue: + type: string + description: The actual value. + expectedValue: + type: string + description: The expected value. + path: + type: string + format: json-path + description: The json path. + example: $.id + required: + - actualValue + - expectedValue + - path + example: + general: + detail: Unsupported type 'String' for field '$.id'. Expected type is 'Object'. + actualValue: String + expectedValue: Object + path: $.id + type: https://hivemq.com/edge/api/model/UnsupportedFieldValidationError + BehaviorPolicyValidationError: + allOf: + - $ref: '#/components/schemas/ValidationError' + - oneOf: + - $ref: '#/components/schemas/IllegalEventTransitionValidationError' + - $ref: '#/components/schemas/IllegalFunctionValidationError' + - $ref: '#/components/schemas/InvalidSchemaVersionValidationError' + - $ref: '#/components/schemas/AtLeastOneFieldMissingValidationError' + - $ref: '#/components/schemas/EmptyFieldValidationError' + - $ref: '#/components/schemas/InvalidFieldLengthValidationError' + - $ref: '#/components/schemas/InvalidFieldValueValidationError' + - $ref: '#/components/schemas/InvalidIdentifierValidationError' + - $ref: '#/components/schemas/MissingFieldValidationError' + - $ref: '#/components/schemas/UnsupportedFieldValidationError' + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/AtLeastOneFieldMissingValidationError: '#/components/schemas/AtLeastOneFieldMissingValidationError' + https://hivemq.com/edge/api/model/EmptyFieldValidationError: '#/components/schemas/EmptyFieldValidationError' + https://hivemq.com/edge/api/model/IllegalEventTransitionValidationError: '#/components/schemas/IllegalEventTransitionValidationError' + https://hivemq.com/edge/api/model/IllegalFunctionValidationError: '#/components/schemas/IllegalFunctionValidationError' + https://hivemq.com/edge/api/model/InvalidFieldLengthValidationError: '#/components/schemas/InvalidFieldLengthValidationError' + https://hivemq.com/edge/api/model/InvalidFieldValueValidationError: '#/components/schemas/InvalidFieldValueValidationError' + https://hivemq.com/edge/api/model/InvalidIdentifierValidationError: '#/components/schemas/InvalidIdentifierValidationError' + https://hivemq.com/edge/api/model/InvalidSchemaVersionValidationError: '#/components/schemas/InvalidSchemaVersionValidationError' + https://hivemq.com/edge/api/model/MissingFieldValidationError: '#/components/schemas/MissingFieldValidationError' + https://hivemq.com/edge/api/model/UnsupportedFieldValidationError: '#/components/schemas/UnsupportedFieldValidationError' + BehaviorPolicyInvalidErrors: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + - type: object + properties: + childErrors: + type: array + description: List of child validation errors. + items: + $ref: '#/components/schemas/BehaviorPolicyValidationError' + required: + - childErrors + example: + general: + status: 400 + title: Behavior Policy Invalid + detail: Behavior policy is invalid due to validation errors. + type: https://hivemq.com/edge/api/model/BehaviorPolicyInvalidErrors + childErrors: + - detail: The transition from state 'state1' to state 'state2' on event 'event1' in '$.path' is not defined for behavior 'id1'. + fromState: state1 + toState: state2 + path: $.path + id: id1 + type: https://hivemq.com/edge/api/model/IllegalEventTransitionValidationError + BehaviorPolicyNotFoundError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + - type: object + properties: + id: + type: string + description: The data policy id. + example: abc + required: + - id + example: + general: + status: 404 + title: Behavior Policy Not Found + detail: Behavior policy with ID 'abc' is not found. + id: abc + type: https://hivemq.com/edge/api/model/BehaviorPolicyNotFoundError + BehaviorPolicyRejectedError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + example: + general: + status: 400 + title: Behavior Policy Rejected + detail: Behavior policy is rejected. + type: https://hivemq.com/edge/api/model/BehaviorPolicyRejectedError + BehaviorPolicyUpdateFailureError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + - type: object + properties: + id: + type: string + description: The ID of the policy that failed to update. + example: abc + required: + - id + example: + general: + status: 400 + title: Behavior Policy Update Failed + detail: Behavior policy with ID 'abc' update failed. + id: abc + type: https://hivemq.com/edge/api/model/BehaviorPolicyUpdateFailureError + ClientDisconnectedError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + - type: object + properties: + id: + type: string + description: The client id. + example: abc + required: + - id + example: + general: + status: 404 + title: Client Disconnected + detail: Client with ID 'abc' is disconnected. + id: abc + type: https://hivemq.com/edge/api/model/ClientDisconnectedError + ClientNotFoundError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + - type: object + properties: + id: + type: string + description: The client id. + example: abc + required: + - id + example: + general: + status: 404 + title: Client Not Found + detail: Client with ID 'abc' is not found. + id: abc + type: https://hivemq.com/edge/api/model/ClientNotFoundError + DataPolicyAlreadyPresentError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + - type: object + properties: + id: + type: string + description: The data policy id. + example: abc + required: + - id + example: + general: + status: 409 + title: Data Policy Already Present + detail: The given data policy 'abc' is already present. + id: abc + type: https://hivemq.com/edge/api/model/DataPolicyAlreadyPresentError + DataPolicyCreationFailureError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + example: + general: + status: 400 + title: Data Policy Creation Failed + detail: 'Data policy creation failed: The policy was rejected.' + type: https://hivemq.com/edge/api/model/DataPolicyCreationFailureError + DataPolicyValidationError: + allOf: + - $ref: '#/components/schemas/ValidationError' + - oneOf: + - $ref: '#/components/schemas/AtMostOneFunctionValidationError' + - $ref: '#/components/schemas/FunctionMustBePairedValidationError' + - $ref: '#/components/schemas/InvalidFunctionOrderValidationError' + - $ref: '#/components/schemas/InvalidSchemaVersionValidationError' + - $ref: '#/components/schemas/UnknownVariableValidationError' + - $ref: '#/components/schemas/EmptyFieldValidationError' + - $ref: '#/components/schemas/InvalidFieldLengthValidationError' + - $ref: '#/components/schemas/InvalidFieldValueValidationError' + - $ref: '#/components/schemas/InvalidIdentifierValidationError' + - $ref: '#/components/schemas/MissingFieldValidationError' + - $ref: '#/components/schemas/UnsupportedFieldValidationError' + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/AtMostOneFunctionValidationError: '#/components/schemas/AtMostOneFunctionValidationError' + https://hivemq.com/edge/api/model/EmptyFieldValidationError: '#/components/schemas/EmptyFieldValidationError' + https://hivemq.com/edge/api/model/FunctionMustBePairedValidationError: '#/components/schemas/FunctionMustBePairedValidationError' + https://hivemq.com/edge/api/model/InvalidFieldLengthValidationError: '#/components/schemas/InvalidFieldLengthValidationError' + https://hivemq.com/edge/api/model/InvalidFieldValueValidationError: '#/components/schemas/InvalidFieldValueValidationError' + https://hivemq.com/edge/api/model/InvalidFunctionOrderValidationError: '#/components/schemas/InvalidFunctionOrderValidationError' + https://hivemq.com/edge/api/model/InvalidIdentifierValidationError: '#/components/schemas/InvalidIdentifierValidationError' + https://hivemq.com/edge/api/model/InvalidSchemaVersionValidationError: '#/components/schemas/InvalidSchemaVersionValidationError' + https://hivemq.com/edge/api/model/MissingFieldValidationError: '#/components/schemas/MissingFieldValidationError' + https://hivemq.com/edge/api/model/UnknownVariableValidationError: '#/components/schemas/UnknownVariableValidationError' + https://hivemq.com/edge/api/model/UnsupportedFieldValidationError: '#/components/schemas/UnsupportedFieldValidationError' + DataPolicyInvalidErrors: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + - type: object + properties: + childErrors: + type: array + description: List of child validation errors. + items: + $ref: '#/components/schemas/DataPolicyValidationError' + required: + - childErrors + example: + general: + status: 400 + title: Data Policy Invalid + detail: Data policy is invalid due to validation errors. + type: https://hivemq.com/edge/api/model/DataPolicyInvalidErrors + childErrors: + - detail: The pipeline must contain at most one 'function1' function, but 3 were found at ['$.path1', '$.path2', '$.path3']. + function: function1 + occurrences: 3 + paths: + - $.path1 + - $.path2 + - $.path3 + type: https://hivemq.com/edge/api/model/AtMostOneFunctionValidationError + DataPolicyNotFoundError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + - type: object + properties: + id: + type: string + description: The data policy id. + example: abc + required: + - id + example: + general: + status: 404 + title: Data Policy Not Found + detail: Data policy with ID 'abc' is not found. + id: abc + type: https://hivemq.com/edge/api/model/DataPolicyNotFoundError + DataPolicyRejectedError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + example: + general: + status: 400 + title: Data Policy Rejected + detail: Data policy is rejected. + type: https://hivemq.com/edge/api/model/DataPolicyRejectedError + DataPolicyUpdateFailureError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + - type: object + properties: + id: + type: string + description: The ID of the policy that failed to update. + example: abc + required: + - id + example: + general: + status: 400 + title: Data Policy Update Failed + detail: Data policy with ID 'abc' update failed. + id: abc + type: https://hivemq.com/edge/api/model/DataPolicyUpdateFailureError + PolicyIdMismatchError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + - type: object + properties: + actualId: + type: string + description: The actual id. + example: id1 + expectedId: + type: string + description: The expected id. + example: id2 + required: + - actualId + - expectedId + example: + general: + status: 400 + title: Policy ID Mismatch + detail: The policy ID 'id1' in the request parameter does not match the policy ID 'id2' in the policy request body. + id: abc + type: https://hivemq.com/edge/api/model/PolicyIdMismatchError + PolicyInsufficientStorageError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + - type: object + properties: + id: + type: string + description: The policy id. + example: abc + required: + - id + example: + general: + status: 507 + title: Policy Insufficient Storage + detail: Policy with ID '123' could not be added because of insufficient server storage. + id: abc + type: https://hivemq.com/edge/api/model/PolicyInsufficientStorageError + PolicyNotFoundError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + - type: object + properties: + id: + type: string + description: The policy id. + example: abc + required: + - id + example: + general: + status: 404 + title: Policy Not Found + detail: Policy with ID 'abc' is not found. + id: abc + type: https://hivemq.com/edge/api/model/PolicyNotFoundError + SchemaAlreadyPresentError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + - type: object + properties: + id: + type: string + description: The schema id. + example: abc + required: + - id + example: + general: + status: 409 + title: Schema Already Present + detail: The given schema is already present as the latest version for the schema id 'abc'. + id: abc + type: https://hivemq.com/edge/api/model/SchemaAlreadyPresentError + SchemaEtagMismatchError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + - type: object + properties: + id: + type: string + description: The schema id. + example: abc + eTag: + type: string + description: The eTag. + example: 33a64df551425fcc55e4d42a148795d9f25f89d4 + required: + - id + example: + general: + status: 412 + title: Schema eTag Mismatch + detail: Schema with id 'abc' does not match the given etag '33a64df551425fcc55e4d42a148795d9f25f89d4'. + id: abc + eTag: 33a64df551425fcc55e4d42a148795d9f25f89d4 + type: https://hivemq.com/edge/api/model/SchemaEtagMismatchError + SchemaInsufficientStorageError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + - type: object + properties: + id: + type: string + description: The policy id. + example: abc + required: + - id + example: + general: + status: 507 + title: Schema Insufficient Storage + detail: Schema with ID '123' could not be added because of insufficient server storage. + id: abc + type: https://hivemq.com/edge/api/model/SchemaInsufficientStorageError + SchemaValidationError: + allOf: + - $ref: '#/components/schemas/ValidationError' + - oneOf: + - $ref: '#/components/schemas/EmptyFieldValidationError' + - $ref: '#/components/schemas/InvalidFieldLengthValidationError' + - $ref: '#/components/schemas/InvalidFieldValueValidationError' + - $ref: '#/components/schemas/InvalidIdentifierValidationError' + - $ref: '#/components/schemas/MissingFieldValidationError' + - $ref: '#/components/schemas/UnsupportedFieldValidationError' + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/EmptyFieldValidationError: '#/components/schemas/EmptyFieldValidationError' + https://hivemq.com/edge/api/model/InvalidFieldLengthValidationError: '#/components/schemas/InvalidFieldLengthValidationError' + https://hivemq.com/edge/api/model/InvalidFieldValueValidationError: '#/components/schemas/InvalidFieldValueValidationError' + https://hivemq.com/edge/api/model/InvalidIdentifierValidationError: '#/components/schemas/InvalidIdentifierValidationError' + https://hivemq.com/edge/api/model/MissingFieldValidationError: '#/components/schemas/MissingFieldValidationError' + https://hivemq.com/edge/api/model/UnsupportedFieldValidationError: '#/components/schemas/UnsupportedFieldValidationError' + SchemaInvalidErrors: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + - type: object + properties: + childErrors: + type: array + description: List of child validation errors. + items: + $ref: '#/components/schemas/SchemaValidationError' + required: + - childErrors + example: + general: + status: 400 + title: Schema Invalid + detail: Schema is invalid due to validation errors. + type: https://hivemq.com/edge/api/model/SchemaInvalidErrors + childErrors: + - detail: The length of script field '$.id' 1025 must be between 0 and 1024. + paths: $.id + value: aaa...aaa + actualLength: 1025 + expectedMinimumLength: 0 + expectedMaximumLength: 1024 + type: https://hivemq.com/edge/api/model/InvalidFieldLengthValidationError + SchemaNotFoundError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + - type: object + properties: + id: + type: string + description: The schema ID. + example: abc + required: + - id + example: + general: + status: 404 + title: Schema Not Found + detail: Schema with ID 'abc' is not found. + id: abc + type: https://hivemq.com/edge/api/model/SchemaNotFoundError + SchemaParsingFailureError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + - type: object + properties: + alias: + type: string + description: The schema alias. + example: abc + required: + - alias + example: + general: + status: 400 + title: Schema Parsing Failure + detail: The given schema 'abc' could not be parsed. + alias: abc + type: https://hivemq.com/edge/api/model/SchemaParsingFailureError + SchemaReferencedError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + - type: object + properties: + id: + type: string + description: The schema ID. + example: abc + required: + - id + example: + general: + status: 400 + title: Schema Referenced + detail: Schema with ID 'abc' is referenced. + id: abc + type: https://hivemq.com/edge/api/model/SchemaReferencedError + ScriptAlreadyPresentError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + - type: object + properties: + id: + type: string + description: The script id. + example: abc + required: + - id + example: + general: + status: 409 + title: Script Already Present + detail: The given script 'abc' is already present. + id: abc + type: https://hivemq.com/edge/api/model/ScriptAlreadyPresentError + ScriptCreationFailureError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + example: + general: + status: 400 + title: Script Creation Failure + detail: The given script could not be created. + type: https://hivemq.com/edge/api/model/ScriptCreationFailureError + ScriptEtagMismatchError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + - type: object + properties: + id: + type: string + description: The script id. + example: abc + eTag: + type: string + description: The eTag. + example: 33a64df551425fcc55e4d42a148795d9f25f89d4 + required: + - id + example: + general: + status: 412 + title: Script eTag Mismatch + detail: Script with id 'abc' does not match the given etag '33a64df551425fcc55e4d42a148795d9f25f89d4'. + id: abc + eTag: 33a64df551425fcc55e4d42a148795d9f25f89d4 + type: https://hivemq.com/edge/api/model/ScriptEtagMismatchError + ScriptInsufficientStorageError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + - type: object + properties: + id: + type: string + description: The policy id. + example: abc + required: + - id + example: + general: + status: 507 + title: Script Insufficient Storage + detail: Script with ID '123' could not be added because of insufficient server storage. + id: abc + type: https://hivemq.com/edge/api/model/ScriptInsufficientStorageError + ScriptValidationError: + allOf: + - $ref: '#/components/schemas/ValidationError' + - oneOf: + - $ref: '#/components/schemas/InvalidFieldLengthValidationError' + - $ref: '#/components/schemas/InvalidFieldValueValidationError' + - $ref: '#/components/schemas/InvalidIdentifierValidationError' + - $ref: '#/components/schemas/MissingFieldValidationError' + - $ref: '#/components/schemas/UnsupportedFieldValidationError' + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/InvalidFieldLengthValidationError: '#/components/schemas/InvalidFieldLengthValidationError' + https://hivemq.com/edge/api/model/InvalidFieldValueValidationError: '#/components/schemas/InvalidFieldValueValidationError' + https://hivemq.com/edge/api/model/InvalidIdentifierValidationError: '#/components/schemas/InvalidIdentifierValidationError' + https://hivemq.com/edge/api/model/MissingFieldValidationError: '#/components/schemas/MissingFieldValidationError' + https://hivemq.com/edge/api/model/UnsupportedFieldValidationError: '#/components/schemas/UnsupportedFieldValidationError' + ScriptInvalidErrors: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + - type: object + properties: + childErrors: + type: array + description: List of child validation errors. + items: + $ref: '#/components/schemas/ScriptValidationError' + required: + - childErrors + example: + general: + status: 400 + title: Script Invalid + detail: Script is invalid due to validation errors. + type: https://hivemq.com/edge/api/model/ScriptInvalidErrors + childErrors: + - detail: The length of script field '$.id' 1025 must be between 0 and 1024. + paths: $.id + value: aaa...aaa + actualLength: 1025 + expectedMinimumLength: 0 + expectedMaximumLength: 1024 + type: https://hivemq.com/edge/api/model/InvalidFieldLengthValidationError + ScriptNotFoundError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + - type: object + properties: + id: + type: string + description: The script ID. + example: abc + required: + - id + example: + general: + status: 404 + title: Script Not Found + detail: Script with ID 'abc' is not found. + id: abc + type: https://hivemq.com/edge/api/model/ScriptNotFoundError + ScriptParsingFailureError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + example: + general: + status: 400 + title: Script Parsing Failure + detail: The given script 'abc' could not be parsed. + type: https://hivemq.com/edge/api/model/ScriptParsingFailureError + ScriptReferencedError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + - type: object + properties: + id: + type: string + description: The script ID. + example: abc + required: + - id + example: + general: + status: 400 + title: Script Referenced + detail: Script with ID 'abc' is referenced. + id: abc + type: https://hivemq.com/edge/api/model/ScriptReferencedError + ScriptSanitationFailureError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + example: + general: + status: 400 + title: Script Sanitation Failure + detail: The given script could not be sanitized. + type: https://hivemq.com/edge/api/model/ScriptSanitationFailureError + TopicFilterMismatchError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + - type: object + properties: + path: + type: string + description: The json path of the topic filter. + example: $.filter + required: + - path + example: + general: + status: 400 + title: Topic Filter Mismatch + detail: The topic filter '$.filter' mismatches. + type: https://hivemq.com/edge/api/model/TopicFilterMismatchError + InsufficientStorageError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + example: + general: + status: 507 + title: Insufficient Storage + detail: Insufficient Storage. + type: https://hivemq.com/edge/api/model/InsufficientStorageError + InternalServerError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + example: + general: + status: 500 + title: Internal Server Error + detail: An unexpected error occurred, check the logs. + type: https://hivemq.com/edge/api/model/InternalServerError + creation: + status: 500 + title: Internal Server Error + detail: 'An unexpected error occurred: Exception during creation of the Json Schema for functions.' + type: https://hivemq.com/edge/api/model/InternalServerError + InvalidQueryParameterError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + - type: object + properties: + parameter: + type: string + description: The query parameter. + required: + - parameter + example: + general: + status: 400 + title: Query Parameter is Invalid + detail: 'Query parameter ''a'' is invalid: ''a'' could not be parsed.' + parameter: a + type: https://hivemq.com/edge/api/model/InvalidQueryParameterError + PreconditionFailedError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + example: + general: + status: 412 + title: Precondition Failed + detail: 'A precondition required for fulfilling the request was not fulfilled: Policy does not match the given etag ''abc''.' + type: https://hivemq.com/edge/api/model/PreconditionFailedError + RequestBodyMissingError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + example: + general: + status: 400 + title: Required Request Body Missing + detail: Required request body is missing. + type: https://hivemq.com/edge/api/model/RequestBodyMissingError + RequestBodyParameterMissingError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + - type: object + properties: + parameter: + type: string + description: The the missing request body parameter. + required: + - parameter + example: + general: + status: 400 + title: Required Request Body Parameter Missing + detail: Required request body parameter 'a' is missing. + parameter: a + type: https://hivemq.com/edge/api/model/RequestBodyParameterMissingError + TemporaryNotAvailableError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + example: + general: + status: 503 + title: Endpoint Temporarily not Available + detail: The endpoint is temporarily not available, please try again later. + type: https://hivemq.com/edge/api/model/TemporaryNotAvailableError + UrlParameterMissingError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + - type: object + properties: + parameter: + type: string + description: The name of the missing parameter. + required: + - parameter + example: + general: + status: 400 + title: Required URL Parameter Missing + detail: Required URL parameter 'a' is missing. + parameter: a + type: https://hivemq.com/edge/api/model/UrlParameterMissingError + JsonNode: + type: object + description: The arguments of the fsm derived from the behavior policy. + FsmStateInformationItem: + type: object + description: List of result items that are returned by this endpoint + properties: + arguments: + $ref: '#/components/schemas/JsonNode' + behaviorId: + type: string + description: The unique identifier of the policy. + firstSetAt: + type: string + description: The timestamp when this state was set the first time. + policyId: + type: string + description: The unique identifier of the policy. + stateName: type: string description: The name of the fsm state. stateType: @@ -5201,8 +6650,6 @@ components: description: List of result items that are returned by this endpoint items: $ref: '#/components/schemas/DataPolicy' - Errors: - type: object PolicyType: description: The type of policy in Data Hub type: string diff --git a/ext/hivemq-edge-openapi-2025.17-SNAPSHOT.yaml b/ext/hivemq-edge-openapi-2025.17-SNAPSHOT.yaml index 23c7a87a0f..7fcb625800 100644 --- a/ext/hivemq-edge-openapi-2025.17-SNAPSHOT.yaml +++ b/ext/hivemq-edge-openapi-2025.17-SNAPSHOT.yaml @@ -14,7 +14,7 @@ info: ## OpenAPI HiveMQ's REST API provides an OpenAPI 3.0 schema definition that can imported into popular API tooling (e.g. Postman) or can be used to generate client-code for multiple programming languages. title: HiveMQ Edge REST API - version: 2025.14-SNAPSHOT + version: 2025.15-SNAPSHOT x-logo: url: https://www.hivemq.com/img/svg/hivemq-bee.svg tags: @@ -357,12 +357,23 @@ paths: schema: $ref: '#/components/schemas/BehaviorPolicyList' description: Success + '400': + content: + application/problem+json: + schema: + oneOf: + - $ref: '#/components/schemas/InvalidQueryParameterError' + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/InvalidQueryParameterError: '#/components/schemas/InvalidQueryParameterError' + description: URL parameter missing '503': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' - description: Temporarily not available + $ref: '#/components/schemas/TemporaryNotAvailableError' + description: Request resource temporary unavailable summary: Get all policies tags: - Data Hub - Behavior Policies @@ -447,34 +458,45 @@ paths: description: Success '400': content: - application/json: - schema: - $ref: '#/components/schemas/ProblemDetails' + application/problem+json: + schema: + oneOf: + - $ref: '#/components/schemas/BehaviorPolicyCreationFailureError' + - $ref: '#/components/schemas/BehaviorPolicyInvalidErrors' + - $ref: '#/components/schemas/BehaviorPolicyRejectedError' + - $ref: '#/components/schemas/RequestBodyMissingError' + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/BehaviorPolicyCreationFailureError: '#/components/schemas/BehaviorPolicyCreationFailureError' + https://hivemq.com/edge/api/model/BehaviorPolicyInvalidErrors: '#/components/schemas/BehaviorPolicyInvalidErrors' + https://hivemq.com/edge/api/model/BehaviorPolicyRejectedError: '#/components/schemas/BehaviorPolicyRejectedError' + https://hivemq.com/edge/api/model/RequestBodyMissingError: '#/components/schemas/RequestBodyMissingError' description: Policy creation failed '409': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' - description: Already exists + $ref: '#/components/schemas/BehaviorPolicyAlreadyPresentError' + description: Behavior policy already present '500': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' - description: Internal error + $ref: '#/components/schemas/InternalServerError' + description: Internal server error '503': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' - description: Temporarily unavailable + $ref: '#/components/schemas/TemporaryNotAvailableError' + description: Request resource temporary unavailable '507': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' - description: Insufficient storage error + $ref: '#/components/schemas/PolicyInsufficientStorageError' + description: Insufficient storage summary: Create a new policy tags: - Data Hub - Behavior Policies @@ -504,34 +526,39 @@ paths: description: Success, no response body '400': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + oneOf: + - $ref: '#/components/schemas/UrlParameterMissingError' + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/UrlParameterMissingError: '#/components/schemas/UrlParameterMissingError' description: URL parameter missing '404': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' - description: Policy not found + $ref: '#/components/schemas/PolicyNotFoundError' + description: Behavior policy not found '412': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/PreconditionFailedError' description: Precondition failed '500': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' - description: Internal error + $ref: '#/components/schemas/InternalServerError' + description: Internal server error '503': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' - description: Temporarily not available + $ref: '#/components/schemas/TemporaryNotAvailableError' + description: Request resource temporary unavailable summary: Delete a behavior policy tags: - Data Hub - Behavior Policies @@ -599,16 +626,33 @@ paths: description: Success '400': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' - description: Invalid query parameter + oneOf: + - $ref: '#/components/schemas/UrlParameterMissingError' + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/UrlParameterMissingError: '#/components/schemas/UrlParameterMissingError' + description: Bad request '404': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/BehaviorPolicyNotFoundError' description: Policy not found + '500': + content: + application/problem+json: + schema: + $ref: '#/components/schemas/InternalServerError' + description: Internal server error + '503': + content: + application/problem+json: + schema: + $ref: '#/components/schemas/TemporaryNotAvailableError' + description: Request resource temporary unavailable summary: Get a policy tags: - Data Hub - Behavior Policies @@ -709,41 +753,56 @@ paths: description: Success '400': content: - application/json: - schema: - $ref: '#/components/schemas/ProblemDetails' - description: Policy creation failed + application/problem+json: + schema: + oneOf: + - $ref: '#/components/schemas/RequestBodyMissingError' + - $ref: '#/components/schemas/UrlParameterMissingError' + - $ref: '#/components/schemas/BehaviorPolicyCreationFailureError' + - $ref: '#/components/schemas/BehaviorPolicyInvalidErrors' + - $ref: '#/components/schemas/BehaviorPolicyUpdateFailureError' + - $ref: '#/components/schemas/PolicyIdMismatchError' + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/RequestBodyMissingError: '#/components/schemas/RequestBodyMissingError' + https://hivemq.com/edge/api/model/UrlParameterMissingError: '#/components/schemas/UrlParameterMissingError' + https://hivemq.com/edge/api/model/BehaviorPolicyCreationFailureError: '#/components/schemas/BehaviorPolicyCreationFailureError' + https://hivemq.com/edge/api/model/BehaviorPolicyInvalidErrors: '#/components/schemas/BehaviorPolicyInvalidErrors' + https://hivemq.com/edge/api/model/BehaviorPolicyUpdateFailureError: '#/components/schemas/BehaviorPolicyUpdateFailureError' + https://hivemq.com/edge/api/model/PolicyIdMismatchError: '#/components/schemas/PolicyIdMismatchError' + description: Behavior policy creation failed '404': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' - description: Policy not found + $ref: '#/components/schemas/BehaviorPolicyNotFoundError' + description: Data policy not found '412': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/PreconditionFailedError' description: Precondition failed '500': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' - description: Internal error + $ref: '#/components/schemas/InternalServerError' + description: Internal server error '503': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' - description: Temporarily unavailable + $ref: '#/components/schemas/TemporaryNotAvailableError' + description: Request resource temporary unavailable '507': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' - description: Insufficient storage error - summary: Update an existing policy + $ref: '#/components/schemas/PolicyInsufficientStorageError' + description: Insufficient storage + summary: Update an existing behavior policy tags: - Data Hub - Behavior Policies /api/v1/data-hub/behavior-validation/states/{clientId}: @@ -787,22 +846,34 @@ paths: description: Success '400': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + oneOf: + - $ref: '#/components/schemas/UrlParameterMissingError' + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/UrlParameterMissingError: '#/components/schemas/UrlParameterMissingError' description: URL parameter missing '404': content: - application/json: - schema: - $ref: '#/components/schemas/ProblemDetails' - description: Client is disconnected + application/problem+json: + schema: + oneOf: + - $ref: '#/components/schemas/ClientDisconnectedError' + - $ref: '#/components/schemas/ClientNotFoundError' + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/ClientDisconnectedError: '#/components/schemas/ClientDisconnectedError' + https://hivemq.com/edge/api/model/ClientNotFoundError: '#/components/schemas/ClientNotFoundError' + description: Client error '500': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' - description: Internal Server error + $ref: '#/components/schemas/InternalServerError' + description: Internal server error summary: Get the state of a client tags: - Data Hub - State @@ -1051,27 +1122,20 @@ paths: description: Success '400': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + oneOf: + - $ref: '#/components/schemas/InvalidQueryParameterError' + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/InvalidQueryParameterError: '#/components/schemas/InvalidQueryParameterError' description: URL parameter missing - '404': - content: - application/json: - schema: - $ref: '#/components/schemas/ProblemDetails' - description: DataPolicy not found - '500': - content: - application/json: - schema: - $ref: '#/components/schemas/ProblemDetails' - description: Internal server error '503': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/TemporaryNotAvailableError' description: Request resource temporary unavailable summary: Get all data policies tags: @@ -1155,33 +1219,44 @@ paths: description: Success '400': content: - application/json: - schema: - $ref: '#/components/schemas/ProblemDetails' - description: DataPolicy creation failed + application/problem+json: + schema: + oneOf: + - $ref: '#/components/schemas/RequestBodyMissingError' + - $ref: '#/components/schemas/DataPolicyCreationFailureError' + - $ref: '#/components/schemas/DataPolicyInvalidErrors' + - $ref: '#/components/schemas/DataPolicyRejectedError' + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/RequestBodyMissingError: '#/components/schemas/RequestBodyMissingError' + https://hivemq.com/edge/api/model/DataPolicyCreationFailureError: '#/components/schemas/DataPolicyCreationFailureError' + https://hivemq.com/edge/api/model/DataPolicyInvalidErrors: '#/components/schemas/DataPolicyInvalidErrors' + https://hivemq.com/edge/api/model/DataPolicyRejectedError: '#/components/schemas/DataPolicyRejectedError' + description: Data policy creation failed '409': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' - description: DataPolicy already present + $ref: '#/components/schemas/DataPolicyAlreadyPresentError' + description: Data policy already present '500': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/InternalServerError' description: Internal server error '503': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/TemporaryNotAvailableError' description: Request resource temporary unavailable '507': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/PolicyInsufficientStorageError' description: Insufficient storage summary: Create a new data policy tags: @@ -1212,27 +1287,38 @@ paths: description: Success, no response body '400': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + oneOf: + - $ref: '#/components/schemas/UrlParameterMissingError' + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/UrlParameterMissingError: '#/components/schemas/UrlParameterMissingError' description: URL parameter missing '404': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' - description: DataPolicy not found + $ref: '#/components/schemas/PolicyNotFoundError' + description: Data policy not found + '412': + content: + application/problem+json: + schema: + $ref: '#/components/schemas/PreconditionFailedError' + description: Precondition failed '500': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/InternalServerError' description: Internal server error '503': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/TemporaryNotAvailableError' description: Request resource temporary unavailable summary: Delete a data policy tags: @@ -1300,32 +1386,33 @@ paths: description: Success '400': content: - application/json: - examples: - param-missing: - description: Example response when a required parameter is missing. - summary: Required URL parameter missing - value: - errors: - - title: Required parameter missing - detail: Required URL parameter 'parameterName' is missing + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + oneOf: + - $ref: '#/components/schemas/UrlParameterMissingError' + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/UrlParameterMissingError: '#/components/schemas/UrlParameterMissingError' description: Bad request '404': content: - application/json: - examples: - not-found: - description: Policy not found - summary: Not found - value: - errors: - - title: Resource not found - detail: Resource with id 'my-resource-id' not found + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/PolicyNotFoundError' description: Resource not found + '500': + content: + application/problem+json: + schema: + $ref: '#/components/schemas/InternalServerError' + description: Internal server error + '503': + content: + application/problem+json: + schema: + $ref: '#/components/schemas/TemporaryNotAvailableError' + description: Request resource temporary unavailable summary: Get a data policy tags: - Data Hub - Data Policies @@ -1425,33 +1512,56 @@ paths: description: Success '400': content: - application/json: - schema: - $ref: '#/components/schemas/ProblemDetails' - description: DataPolicy creation failed + application/problem+json: + schema: + oneOf: + - $ref: '#/components/schemas/RequestBodyMissingError' + - $ref: '#/components/schemas/UrlParameterMissingError' + - $ref: '#/components/schemas/DataPolicyCreationFailureError' + - $ref: '#/components/schemas/DataPolicyInvalidErrors' + - $ref: '#/components/schemas/DataPolicyUpdateFailureError' + - $ref: '#/components/schemas/PolicyIdMismatchError' + - $ref: '#/components/schemas/TopicFilterMismatchError' + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/RequestBodyMissingError: '#/components/schemas/RequestBodyMissingError' + https://hivemq.com/edge/api/model/UrlParameterMissingError: '#/components/schemas/UrlParameterMissingError' + https://hivemq.com/edge/api/model/DataPolicyCreationFailureError: '#/components/schemas/DataPolicyCreationFailureError' + https://hivemq.com/edge/api/model/DataPolicyInvalidErrors: '#/components/schemas/DataPolicyInvalidErrors' + https://hivemq.com/edge/api/model/DataPolicyUpdateFailureError: '#/components/schemas/DataPolicyUpdateFailureError' + https://hivemq.com/edge/api/model/PolicyIdMismatchError: '#/components/schemas/PolicyIdMismatchError' + https://hivemq.com/edge/api/model/TopicFilterMismatchError: '#/components/schemas/TopicFilterMismatchError' + description: Data policy creation failed '404': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' - description: DataPolicy not found + $ref: '#/components/schemas/DataPolicyNotFoundError' + description: Data policy not found + '412': + content: + application/problem+json: + schema: + $ref: '#/components/schemas/PreconditionFailedError' + description: Precondition failed '500': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/InternalServerError' description: Internal server error '503': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/TemporaryNotAvailableError' description: Request resource temporary unavailable '507': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/PolicyInsufficientStorageError' description: Insufficient storage summary: Update an existing data policy tags: @@ -1537,9 +1647,9 @@ paths: description: Success '500': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/Errors' + $ref: '#/components/schemas/InternalServerError' description: Internal server error summary: Get all FSMs as a JSON Schema tags: @@ -1699,9 +1809,9 @@ paths: description: Success '500': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/InternalServerError' description: Internal server error summary: Get all functions as a JSON Schema tags: @@ -1719,9 +1829,9 @@ paths: description: Success '500': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/InternalServerError' description: Internal server error summary: Get all interpolation variables tags: @@ -1739,9 +1849,9 @@ paths: description: Success '500': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/InternalServerError' description: Internal server error summary: Get all functions as a list of function specifications tags: @@ -1876,11 +1986,22 @@ paths: schema: $ref: '#/components/schemas/SchemaList' description: Success + '400': + content: + application/problem+json: + schema: + oneOf: + - $ref: '#/components/schemas/InvalidQueryParameterError' + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/InvalidQueryParameterError: '#/components/schemas/InvalidQueryParameterError' + description: URL parameter missing '503': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/TemporaryNotAvailableError' description: Request resource temporary unavailable summary: Get all schemas tags: @@ -1927,33 +2048,48 @@ paths: description: Success '400': content: - application/json: - schema: - $ref: '#/components/schemas/ProblemDetails' - description: Schema could not be validatetd + application/problem+json: + schema: + oneOf: + - $ref: '#/components/schemas/RequestBodyParameterMissingError' + - $ref: '#/components/schemas/SchemaInvalidErrors' + - $ref: '#/components/schemas/SchemaParsingFailureError' + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/RequestBodyParameterMissingError: '#/components/schemas/RequestBodyParameterMissingError' + https://hivemq.com/edge/api/model/SchemaInvalidErrors: '#/components/schemas/SchemaInvalidErrors' + https://hivemq.com/edge/api/model/SchemaParsingFailureError: '#/components/schemas/SchemaParsingFailureError' + description: Schema creation failed '409': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' - description: Schema already exists + $ref: '#/components/schemas/SchemaAlreadyPresentError' + description: Schema is already present '412': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' - description: Mismatch between schema and etag + $ref: '#/components/schemas/SchemaEtagMismatchError' + description: Schema doesn't match etag '500': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/InternalServerError' description: Internal server error + '503': + content: + application/problem+json: + schema: + $ref: '#/components/schemas/TemporaryNotAvailableError' + description: Request resource temporary unavailable '507': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/SchemaInsufficientStorageError' description: Insufficient storage summary: Create a new schema tags: @@ -1984,33 +2120,40 @@ paths: description: Success, no response body '400': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' - description: Schema referenced + oneOf: + - $ref: '#/components/schemas/UrlParameterMissingError' + - $ref: '#/components/schemas/SchemaReferencedError' + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/UrlParameterMissingError: '#/components/schemas/UrlParameterMissingError' + https://hivemq.com/edge/api/model/SchemaReferencedError: '#/components/schemas/SchemaReferencedError' + description: URL parameter missing '404': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/SchemaNotFoundError' description: Schema not found '412': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' - description: Mismatch between schema and etag + $ref: '#/components/schemas/SchemaEtagMismatchError' + description: Schema doesn't match etag '500': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' - description: Internal server error + $ref: '#/components/schemas/InternalServerError' + description: Internal Server error '503': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/TemporaryNotAvailableError' description: Request resource temporary unavailable summary: Delete all versions of the schema tags: @@ -2056,22 +2199,33 @@ paths: description: Success '400': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' - description: A url parameter is missing + oneOf: + - $ref: '#/components/schemas/UrlParameterMissingError' + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/UrlParameterMissingError: '#/components/schemas/UrlParameterMissingError' + description: URL parameter missing '404': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/SchemaNotFoundError' description: Schema not found '500': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/InternalServerError' description: Internal server error + '503': + content: + application/problem+json: + schema: + $ref: '#/components/schemas/TemporaryNotAvailableError' + description: Request resource temporary unavailable summary: Get a schema tags: - Data Hub - Schemas @@ -2192,12 +2346,23 @@ paths: schema: $ref: '#/components/schemas/ScriptList' description: Success + '400': + content: + application/problem+json: + schema: + oneOf: + - $ref: '#/components/schemas/InvalidQueryParameterError' + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/InvalidQueryParameterError: '#/components/schemas/InvalidQueryParameterError' + description: URL parameter missing '503': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' - description: Temporary not available + $ref: '#/components/schemas/TemporaryNotAvailableError' + description: Request resource temporary unavailable summary: Get all scripts tags: - Data Hub - Scripts @@ -2243,39 +2408,52 @@ paths: description: Success '400': content: - application/json: - schema: - $ref: '#/components/schemas/ProblemDetails' - description: Script is invalid + application/problem+json: + schema: + oneOf: + - $ref: '#/components/schemas/RequestBodyParameterMissingError' + - $ref: '#/components/schemas/ScriptCreationFailureError' + - $ref: '#/components/schemas/ScriptInvalidErrors' + - $ref: '#/components/schemas/ScriptParsingFailureError' + - $ref: '#/components/schemas/ScriptSanitationFailureError' + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/RequestBodyParameterMissingError: '#/components/schemas/RequestBodyParameterMissingError' + https://hivemq.com/edge/api/model/ScriptCreationFailureError: '#/components/schemas/ScriptCreationFailureError' + https://hivemq.com/edge/api/model/ScriptInvalidErrors: '#/components/schemas/ScriptInvalidErrors' + https://hivemq.com/edge/api/model/ScriptParsingFailureError: '#/components/schemas/ScriptParsingFailureError' + https://hivemq.com/edge/api/model/ScriptSanitationFailureError: '#/components/schemas/ScriptSanitationFailureError' + description: Script creation failed '409': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/ScriptAlreadyPresentError' description: Script is already present '412': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/ScriptEtagMismatchError' description: Script doesn't match etag '500': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/InternalServerError' description: Internal server error '503': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' - description: Temporary not available + $ref: '#/components/schemas/TemporaryNotAvailableError' + description: Request resource temporary unavailable '507': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/ScriptInsufficientStorageError' description: Insufficient storage summary: Create a new script tags: @@ -2303,34 +2481,41 @@ paths: description: Success, no response body '400': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' - description: Script is referenced + oneOf: + - $ref: '#/components/schemas/UrlParameterMissingError' + - $ref: '#/components/schemas/ScriptReferencedError' + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/UrlParameterMissingError: '#/components/schemas/UrlParameterMissingError' + https://hivemq.com/edge/api/model/ScriptReferencedError: '#/components/schemas/ScriptReferencedError' + description: URL parameter missing '404': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/ScriptNotFoundError' description: Script not found '412': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/ScriptEtagMismatchError' description: Script doesn't match etag '500': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/InternalServerError' description: Internal Server error '503': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' - description: Temporary not available + $ref: '#/components/schemas/TemporaryNotAvailableError' + description: Request resource temporary unavailable summary: Delete a script tags: - Data Hub - Scripts @@ -2371,28 +2556,33 @@ paths: description: Success '400': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + oneOf: + - $ref: '#/components/schemas/UrlParameterMissingError' + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/UrlParameterMissingError: '#/components/schemas/UrlParameterMissingError' description: URL parameter missing '404': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/ScriptNotFoundError' description: Script not found '500': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' + $ref: '#/components/schemas/InternalServerError' description: Internal Server error '503': content: - application/json: + application/problem+json: schema: - $ref: '#/components/schemas/ProblemDetails' - description: Temporary not available + $ref: '#/components/schemas/TemporaryNotAvailableError' + description: Request resource temporary unavailable summary: Get a script tags: - Data Hub - Scripts @@ -4916,6 +5106,7 @@ components: detail: type: string errors: + deprecated: true type: array items: $ref: '#/components/schemas/Error' @@ -5080,25 +5271,1283 @@ components: description: List of result items that are returned by this endpoint items: $ref: '#/components/schemas/BehaviorPolicy' - JsonNode: - type: object - description: The arguments of the fsm derived from the behavior policy. - FsmStateInformationItem: - type: object - description: List of result items that are returned by this endpoint - properties: - arguments: - $ref: '#/components/schemas/JsonNode' - behaviorId: - type: string - description: The unique identifier of the policy. - firstSetAt: - type: string - description: The timestamp when this state was set the first time. - policyId: - type: string - description: The unique identifier of the policy. - stateName: + ApiProblemDetails: + allOf: + - $ref: '#/components/schemas/ProblemDetails' + - type: object + required: + - detail + - status + - type + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/BehaviorPolicyAlreadyPresentError: '#/components/schemas/BehaviorPolicyAlreadyPresentError' + https://hivemq.com/edge/api/model/BehaviorPolicyCreationFailureError: '#/components/schemas/BehaviorPolicyCreationFailureError' + https://hivemq.com/edge/api/model/BehaviorPolicyInvalidErrors: '#/components/schemas/BehaviorPolicyInvalidErrors' + https://hivemq.com/edge/api/model/BehaviorPolicyNotFoundError: '#/components/schemas/BehaviorPolicyNotFoundError' + https://hivemq.com/edge/api/model/BehaviorPolicyRejectedError: '#/components/schemas/BehaviorPolicyRejectedError' + https://hivemq.com/edge/api/model/BehaviorPolicyUpdateFailureError: '#/components/schemas/BehaviorPolicyUpdateFailureError' + https://hivemq.com/edge/api/model/ClientDisconnectedError: '#/components/schemas/ClientDisconnectedError' + https://hivemq.com/edge/api/model/ClientNotFoundError: '#/components/schemas/ClientNotFoundError' + https://hivemq.com/edge/api/model/DataPolicyAlreadyPresentError: '#/components/schemas/DataPolicyAlreadyPresentError' + https://hivemq.com/edge/api/model/DataPolicyCreationFailureError: '#/components/schemas/DataPolicyCreationFailureError' + https://hivemq.com/edge/api/model/DataPolicyInvalidErrors: '#/components/schemas/DataPolicyInvalidErrors' + https://hivemq.com/edge/api/model/DataPolicyNotFoundError: '#/components/schemas/DataPolicyNotFoundError' + https://hivemq.com/edge/api/model/DataPolicyRejectedError: '#/components/schemas/DataPolicyRejectedError' + https://hivemq.com/edge/api/model/DataPolicyUpdateFailureError: '#/components/schemas/DataPolicyUpdateFailureError' + https://hivemq.com/edge/api/model/PolicyIdMismatchError: '#/components/schemas/PolicyIdMismatchError' + https://hivemq.com/edge/api/model/PolicyInsufficientStorageError: '#/components/schemas/PolicyInsufficientStorageError' + https://hivemq.com/edge/api/model/PolicyNotFoundError: '#/components/schemas/PolicyNotFoundError' + https://hivemq.com/edge/api/model/SchemaAlreadyPresentError: '#/components/schemas/SchemaAlreadyPresentError' + https://hivemq.com/edge/api/model/SchemaEtagMismatchError: '#/components/schemas/SchemaEtagMismatchError' + https://hivemq.com/edge/api/model/SchemaInsufficientStorageError: '#/components/schemas/SchemaInsufficientStorageError' + https://hivemq.com/edge/api/model/SchemaInvalidErrors: '#/components/schemas/SchemaInvalidErrors' + https://hivemq.com/edge/api/model/SchemaNotFoundError: '#/components/schemas/SchemaNotFoundError' + https://hivemq.com/edge/api/model/SchemaParsingFailureError: '#/components/schemas/SchemaParsingFailureError' + https://hivemq.com/edge/api/model/SchemaReferencedError: '#/components/schemas/SchemaReferencedError' + https://hivemq.com/edge/api/model/ScriptAlreadyPresentError: '#/components/schemas/ScriptAlreadyPresentError' + https://hivemq.com/edge/api/model/ScriptCreationFailureError: '#/components/schemas/ScriptCreationFailureError' + https://hivemq.com/edge/api/model/ScriptEtagMismatchError: '#/components/schemas/ScriptEtagMismatchError' + https://hivemq.com/edge/api/model/ScriptInsufficientStorageError: '#/components/schemas/ScriptInsufficientStorageError' + https://hivemq.com/edge/api/model/ScriptInvalidErrors: '#/components/schemas/ScriptInvalidErrors' + https://hivemq.com/edge/api/model/ScriptNotFoundError: '#/components/schemas/ScriptNotFoundError' + https://hivemq.com/edge/api/model/ScriptParsingFailureError: '#/components/schemas/ScriptParsingFailureError' + https://hivemq.com/edge/api/model/ScriptReferencedError: '#/components/schemas/ScriptReferencedError' + https://hivemq.com/edge/api/model/ScriptSanitationFailureError: '#/components/schemas/ScriptSanitationFailureError' + https://hivemq.com/edge/api/model/TopicFilterMismatchError: '#/components/schemas/TopicFilterMismatchError' + https://hivemq.com/edge/api/model/InsufficientStorageError: '#/components/schemas/InsufficientStorageError' + https://hivemq.com/edge/api/model/InternalServerError: '#/components/schemas/InternalServerError' + https://hivemq.com/edge/api/model/InvalidQueryParameterError: '#/components/schemas/InvalidQueryParameterError' + https://hivemq.com/edge/api/model/PreconditionFailedError: '#/components/schemas/PreconditionFailedError' + https://hivemq.com/edge/api/model/RequestBodyMissingError: '#/components/schemas/RequestBodyMissingError' + https://hivemq.com/edge/api/model/RequestBodyParameterMissingError: '#/components/schemas/RequestBodyParameterMissingError' + https://hivemq.com/edge/api/model/TemporaryNotAvailableError: '#/components/schemas/TemporaryNotAvailableError' + https://hivemq.com/edge/api/model/UrlParameterMissingError: '#/components/schemas/UrlParameterMissingError' + BehaviorPolicyAlreadyPresentError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + - type: object + properties: + id: + type: string + description: The behavior policy id. + example: abc + required: + - id + example: + general: + status: 409 + title: Behavior Policy Already Present + detail: The given behavior policy 'abc' is already present. + id: abc + type: https://hivemq.com/edge/api/model/BehaviorPolicyAlreadyPresentError + BehaviorPolicyCreationFailureError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + example: + general: + status: 400 + title: Behavior Policy Creation Failed + detail: 'Behavior policy creation failed: The policy was rejected.' + type: https://hivemq.com/edge/api/model/BehaviorPolicyCreationFailureError + AtLeastOneFieldMissingValidationError: + allOf: + - $ref: '#/components/schemas/ValidationError' + - type: object + properties: + paths: + type: array + description: The missing json paths. + items: + type: string + format: json-path + description: The json path. + example: + - $.field1 + - $.field2 + required: + - paths + example: + general: + detail: 'At least one of the fields must be present: ''$.field1'', ''$.field2''.' + paths: + - $.field1 + - $.field2 + type: https://hivemq.com/edge/api/model/AtLeastOneFieldMissingValidationError + ValidationError: + type: object + properties: + detail: + type: string + description: Detailed contextual description of the validation error. + type: + type: string + format: uri + description: Type of the validation error. + required: + - detail + - type + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/AtLeastOneFieldMissingValidationError: '#/components/schemas/AtLeastOneFieldMissingValidationError' + https://hivemq.com/edge/api/model/AtMostOneFunctionValidationError: '#/components/schemas/AtMostOneFunctionValidationError' + https://hivemq.com/edge/api/model/EmptyFieldValidationError: '#/components/schemas/EmptyFieldValidationError' + https://hivemq.com/edge/api/model/FunctionMustBePairedValidationError: '#/components/schemas/FunctionMustBePairedValidationError' + https://hivemq.com/edge/api/model/IllegalEventTransitionValidationError: '#/components/schemas/IllegalEventTransitionValidationError' + https://hivemq.com/edge/api/model/IllegalFunctionValidationError: '#/components/schemas/IllegalFunctionValidationError' + https://hivemq.com/edge/api/model/InvalidFieldLengthValidationError: '#/components/schemas/InvalidFieldLengthValidationError' + https://hivemq.com/edge/api/model/InvalidFieldValueValidationError: '#/components/schemas/InvalidFieldValueValidationError' + https://hivemq.com/edge/api/model/InvalidFunctionOrderValidationError: '#/components/schemas/InvalidFunctionOrderValidationError' + https://hivemq.com/edge/api/model/InvalidIdentifierValidationError: '#/components/schemas/InvalidIdentifierValidationError' + https://hivemq.com/edge/api/model/InvalidSchemaVersionValidationError: '#/components/schemas/InvalidSchemaVersionValidationError' + https://hivemq.com/edge/api/model/MissingFieldValidationError: '#/components/schemas/MissingFieldValidationError' + https://hivemq.com/edge/api/model/UnknownVariableValidationError: '#/components/schemas/UnknownVariableValidationError' + https://hivemq.com/edge/api/model/UnsupportedFieldValidationError: '#/components/schemas/UnsupportedFieldValidationError' + AtMostOneFunctionValidationError: + allOf: + - $ref: '#/components/schemas/ValidationError' + - type: object + properties: + function: + type: string + description: The function. + example: function1 + occurrences: + type: integer + format: int32 + description: The occurrences of the function. + minimum: 0 + example: 3 + paths: + type: array + items: + type: string + format: json-path + description: The json paths where the function occurs. + example: + - $.path1 + - $.path2 + - $.path3 + required: + - function + - occurrences + - paths + example: + general: + detail: The pipeline must contain at most one 'function1' function, but 3 were found at ['$.path1', '$.path2', '$.path3']. + function: function1 + occurrences: 3 + paths: + - $.path1 + - $.path2 + - $.path3 + type: https://hivemq.com/edge/api/model/AtMostOneFunctionValidationError + EmptyFieldValidationError: + allOf: + - $ref: '#/components/schemas/ValidationError' + - type: object + properties: + path: + type: string + format: json-path + description: The missing field. + example: $.field + required: + - path + example: + general: + detail: Required field '$.field' is empty. + path: $.field + type: https://hivemq.com/edge/api/model/EmptyFieldValidationError + FunctionMustBePairedValidationError: + allOf: + - $ref: '#/components/schemas/ValidationError' + - type: object + properties: + existingFunction: + type: string + description: The existing function. + example: function1 + missingFunction: + type: string + description: The missing function. + example: function2 + required: + - existingFunction + - missingFunction + example: + general: + detail: If 'function1' function is present in the pipeline, 'function2' function must be present as well. + existingFunction: function1 + missingFunction: function2 + type: https://hivemq.com/edge/api/model/FunctionMustBePairedValidationError + IllegalEventTransitionValidationError: + allOf: + - $ref: '#/components/schemas/ValidationError' + - type: object + properties: + event: + type: string + description: The event name. + example: event1 + fromState: + type: string + description: The event from state. + example: state1 + id: + type: string + description: The event id. + example: abc + path: + type: string + description: The path. + example: $.event + toState: + type: string + description: The event to state. + example: state2 + required: + - event + - fromState + - id + - path + - toState + example: + general: + detail: The transition from state 'state1' to state 'state2' on event 'event1' in '$.event' is not defined for behavior 'abc'. + event: event1 + fromState: state1 + toState: state2 + id: abc + path: $.event + type: https://hivemq.com/edge/api/model/IllegalEventTransitionValidationError + IllegalFunctionValidationError: + allOf: + - $ref: '#/components/schemas/ValidationError' + - type: object + properties: + event: + type: string + description: The event name. + example: event1 + id: + type: string + description: The function id. + example: abc + path: + type: string + format: json-path + description: The json path. + example: $.event + required: + - event + - id + - path + example: + general: + detail: The function 'abc' is not allowed for event 'event1' in '$.event'. + event: event1 + id: abc + path: $.event + type: https://hivemq.com/edge/api/model/IllegalFunctionValidationError + InvalidFieldLengthValidationError: + allOf: + - $ref: '#/components/schemas/ValidationError' + - type: object + properties: + actualLength: + type: integer + format: int32 + description: The actual length of the field value. + example: 10 + expectedMinimumLength: + type: integer + format: int32 + description: The minimum length expected for the field value. + minimum: 0 + example: 5 + expectedMaximumLength: + type: integer + format: int32 + description: The maximum length expected for the field value. + minimum: 0 + example: 20 + path: + type: string + format: json-path + description: The invalid json path. + example: $.field + value: + type: string + description: The invalid value. + example: function transform() { return 'Hello, World!'; } + required: + - actualLength + - expectedMinimumLength + - expectedMaximumLength + - path + - value + example: + general: + detail: The length of script field '$.transform' 48 must be between 0 and 20. + actualLength: 48 + minimumLength: 0 + maximumLength: 20 + path: $.transform + value: function transform() { return 'Hello, World!'; } + type: https://hivemq.com/edge/api/model/InvalidFieldLengthValidationError + InvalidFieldValueValidationError: + allOf: + - $ref: '#/components/schemas/ValidationError' + - type: object + properties: + path: + type: string + format: json-path + description: The invalid json path. + example: $.action.pipeline[1].field + value: + type: string + description: The invalid value. + example: functionDoesNotExist + required: + - path + example: + general: + detail: Referenced function does not exist. + path: $.action.pipeline[1].field + value: functionDoesNotExist + type: https://hivemq.com/edge/api/model/InvalidFieldValueValidationError + InvalidFunctionOrderValidationError: + allOf: + - $ref: '#/components/schemas/ValidationError' + - type: object + properties: + function: + type: string + description: The function. + example: transform + path: + type: string + format: json-path + description: The json path. + example: $.path + previousFunction: + type: string + description: The previous function. + example: init + required: + - function + - path + - previousFunction + example: + general: + detail: The operation at '$.path' with the functionId 'transform' must be after a 'init' operation. + function: transform + path: $.path + previousFunction: init + type: https://hivemq.com/edge/api/model/InvalidFunctionOrderValidationError + InvalidIdentifierValidationError: + allOf: + - $ref: '#/components/schemas/ValidationError' + - type: object + properties: + path: + type: string + format: json-path + description: The invalid identifier path. + example: $.id + value: + type: string + description: The invalid identifier value. + example: invalidId + required: + - path + - value + example: + general: + detail: Identifier script 'id' must begin with a letter and may only consist of lowercase letters, uppercase letters, numbers, periods, hyphens, and underscores. + path: $.id + value: invalidId + type: https://hivemq.com/edge/api/model/InvalidIdentifierValidationError + InvalidSchemaVersionValidationError: + allOf: + - $ref: '#/components/schemas/ValidationError' + - type: object + properties: + id: + type: string + description: The schema id. + example: abc + version: + type: string + description: The schema version. + example: '2' + required: + - id + - version + example: + general: + detail: The referenced schema with id 'abc' and version '2' was not found. + id: abc + version: '2' + type: https://hivemq.com/edge/api/model/InvalidSchemaVersionValidationError + MissingFieldValidationError: + allOf: + - $ref: '#/components/schemas/ValidationError' + - type: object + properties: + path: + type: string + format: json-path + description: The missing path. + example: $.id + required: + - path + example: + general: + detail: Required field '$.id' is missing. + path: $.id + type: https://hivemq.com/edge/api/model/MissingFieldValidationError + UnknownVariableValidationError: + allOf: + - $ref: '#/components/schemas/ValidationError' + - type: object + properties: + path: + type: string + description: The json path of the field. + example: $.path + variables: + type: array + items: + type: string + description: The unknown variables. + example: + - a + - b + - c + required: + - path + - variables + example: + general: + detail: 'Field ''$.path'' contains unknown variables: [a, b, c].' + path: $.path + variables: + - a + - b + - c + type: https://hivemq.com/edge/api/model/UnknownVariableValidationError + UnsupportedFieldValidationError: + allOf: + - $ref: '#/components/schemas/ValidationError' + - type: object + properties: + actualValue: + type: string + description: The actual value. + expectedValue: + type: string + description: The expected value. + path: + type: string + format: json-path + description: The json path. + example: $.id + required: + - actualValue + - expectedValue + - path + example: + general: + detail: Unsupported type 'String' for field '$.id'. Expected type is 'Object'. + actualValue: String + expectedValue: Object + path: $.id + type: https://hivemq.com/edge/api/model/UnsupportedFieldValidationError + BehaviorPolicyValidationError: + allOf: + - $ref: '#/components/schemas/ValidationError' + - oneOf: + - $ref: '#/components/schemas/IllegalEventTransitionValidationError' + - $ref: '#/components/schemas/IllegalFunctionValidationError' + - $ref: '#/components/schemas/InvalidSchemaVersionValidationError' + - $ref: '#/components/schemas/AtLeastOneFieldMissingValidationError' + - $ref: '#/components/schemas/EmptyFieldValidationError' + - $ref: '#/components/schemas/InvalidFieldLengthValidationError' + - $ref: '#/components/schemas/InvalidFieldValueValidationError' + - $ref: '#/components/schemas/InvalidIdentifierValidationError' + - $ref: '#/components/schemas/MissingFieldValidationError' + - $ref: '#/components/schemas/UnsupportedFieldValidationError' + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/AtLeastOneFieldMissingValidationError: '#/components/schemas/AtLeastOneFieldMissingValidationError' + https://hivemq.com/edge/api/model/EmptyFieldValidationError: '#/components/schemas/EmptyFieldValidationError' + https://hivemq.com/edge/api/model/IllegalEventTransitionValidationError: '#/components/schemas/IllegalEventTransitionValidationError' + https://hivemq.com/edge/api/model/IllegalFunctionValidationError: '#/components/schemas/IllegalFunctionValidationError' + https://hivemq.com/edge/api/model/InvalidFieldLengthValidationError: '#/components/schemas/InvalidFieldLengthValidationError' + https://hivemq.com/edge/api/model/InvalidFieldValueValidationError: '#/components/schemas/InvalidFieldValueValidationError' + https://hivemq.com/edge/api/model/InvalidIdentifierValidationError: '#/components/schemas/InvalidIdentifierValidationError' + https://hivemq.com/edge/api/model/InvalidSchemaVersionValidationError: '#/components/schemas/InvalidSchemaVersionValidationError' + https://hivemq.com/edge/api/model/MissingFieldValidationError: '#/components/schemas/MissingFieldValidationError' + https://hivemq.com/edge/api/model/UnsupportedFieldValidationError: '#/components/schemas/UnsupportedFieldValidationError' + BehaviorPolicyInvalidErrors: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + - type: object + properties: + childErrors: + type: array + description: List of child validation errors. + items: + $ref: '#/components/schemas/BehaviorPolicyValidationError' + required: + - childErrors + example: + general: + status: 400 + title: Behavior Policy Invalid + detail: Behavior policy is invalid due to validation errors. + type: https://hivemq.com/edge/api/model/BehaviorPolicyInvalidErrors + childErrors: + - detail: The transition from state 'state1' to state 'state2' on event 'event1' in '$.path' is not defined for behavior 'id1'. + fromState: state1 + toState: state2 + path: $.path + id: id1 + type: https://hivemq.com/edge/api/model/IllegalEventTransitionValidationError + BehaviorPolicyNotFoundError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + - type: object + properties: + id: + type: string + description: The data policy id. + example: abc + required: + - id + example: + general: + status: 404 + title: Behavior Policy Not Found + detail: Behavior policy with ID 'abc' is not found. + id: abc + type: https://hivemq.com/edge/api/model/BehaviorPolicyNotFoundError + BehaviorPolicyRejectedError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + example: + general: + status: 400 + title: Behavior Policy Rejected + detail: Behavior policy is rejected. + type: https://hivemq.com/edge/api/model/BehaviorPolicyRejectedError + BehaviorPolicyUpdateFailureError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + - type: object + properties: + id: + type: string + description: The ID of the policy that failed to update. + example: abc + required: + - id + example: + general: + status: 400 + title: Behavior Policy Update Failed + detail: Behavior policy with ID 'abc' update failed. + id: abc + type: https://hivemq.com/edge/api/model/BehaviorPolicyUpdateFailureError + ClientDisconnectedError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + - type: object + properties: + id: + type: string + description: The client id. + example: abc + required: + - id + example: + general: + status: 404 + title: Client Disconnected + detail: Client with ID 'abc' is disconnected. + id: abc + type: https://hivemq.com/edge/api/model/ClientDisconnectedError + ClientNotFoundError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + - type: object + properties: + id: + type: string + description: The client id. + example: abc + required: + - id + example: + general: + status: 404 + title: Client Not Found + detail: Client with ID 'abc' is not found. + id: abc + type: https://hivemq.com/edge/api/model/ClientNotFoundError + DataPolicyAlreadyPresentError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + - type: object + properties: + id: + type: string + description: The data policy id. + example: abc + required: + - id + example: + general: + status: 409 + title: Data Policy Already Present + detail: The given data policy 'abc' is already present. + id: abc + type: https://hivemq.com/edge/api/model/DataPolicyAlreadyPresentError + DataPolicyCreationFailureError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + example: + general: + status: 400 + title: Data Policy Creation Failed + detail: 'Data policy creation failed: The policy was rejected.' + type: https://hivemq.com/edge/api/model/DataPolicyCreationFailureError + DataPolicyValidationError: + allOf: + - $ref: '#/components/schemas/ValidationError' + - oneOf: + - $ref: '#/components/schemas/AtMostOneFunctionValidationError' + - $ref: '#/components/schemas/FunctionMustBePairedValidationError' + - $ref: '#/components/schemas/InvalidFunctionOrderValidationError' + - $ref: '#/components/schemas/InvalidSchemaVersionValidationError' + - $ref: '#/components/schemas/UnknownVariableValidationError' + - $ref: '#/components/schemas/EmptyFieldValidationError' + - $ref: '#/components/schemas/InvalidFieldLengthValidationError' + - $ref: '#/components/schemas/InvalidFieldValueValidationError' + - $ref: '#/components/schemas/InvalidIdentifierValidationError' + - $ref: '#/components/schemas/MissingFieldValidationError' + - $ref: '#/components/schemas/UnsupportedFieldValidationError' + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/AtMostOneFunctionValidationError: '#/components/schemas/AtMostOneFunctionValidationError' + https://hivemq.com/edge/api/model/EmptyFieldValidationError: '#/components/schemas/EmptyFieldValidationError' + https://hivemq.com/edge/api/model/FunctionMustBePairedValidationError: '#/components/schemas/FunctionMustBePairedValidationError' + https://hivemq.com/edge/api/model/InvalidFieldLengthValidationError: '#/components/schemas/InvalidFieldLengthValidationError' + https://hivemq.com/edge/api/model/InvalidFieldValueValidationError: '#/components/schemas/InvalidFieldValueValidationError' + https://hivemq.com/edge/api/model/InvalidFunctionOrderValidationError: '#/components/schemas/InvalidFunctionOrderValidationError' + https://hivemq.com/edge/api/model/InvalidIdentifierValidationError: '#/components/schemas/InvalidIdentifierValidationError' + https://hivemq.com/edge/api/model/InvalidSchemaVersionValidationError: '#/components/schemas/InvalidSchemaVersionValidationError' + https://hivemq.com/edge/api/model/MissingFieldValidationError: '#/components/schemas/MissingFieldValidationError' + https://hivemq.com/edge/api/model/UnknownVariableValidationError: '#/components/schemas/UnknownVariableValidationError' + https://hivemq.com/edge/api/model/UnsupportedFieldValidationError: '#/components/schemas/UnsupportedFieldValidationError' + DataPolicyInvalidErrors: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + - type: object + properties: + childErrors: + type: array + description: List of child validation errors. + items: + $ref: '#/components/schemas/DataPolicyValidationError' + required: + - childErrors + example: + general: + status: 400 + title: Data Policy Invalid + detail: Data policy is invalid due to validation errors. + type: https://hivemq.com/edge/api/model/DataPolicyInvalidErrors + childErrors: + - detail: The pipeline must contain at most one 'function1' function, but 3 were found at ['$.path1', '$.path2', '$.path3']. + function: function1 + occurrences: 3 + paths: + - $.path1 + - $.path2 + - $.path3 + type: https://hivemq.com/edge/api/model/AtMostOneFunctionValidationError + DataPolicyNotFoundError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + - type: object + properties: + id: + type: string + description: The data policy id. + example: abc + required: + - id + example: + general: + status: 404 + title: Data Policy Not Found + detail: Data policy with ID 'abc' is not found. + id: abc + type: https://hivemq.com/edge/api/model/DataPolicyNotFoundError + DataPolicyRejectedError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + example: + general: + status: 400 + title: Data Policy Rejected + detail: Data policy is rejected. + type: https://hivemq.com/edge/api/model/DataPolicyRejectedError + DataPolicyUpdateFailureError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + - type: object + properties: + id: + type: string + description: The ID of the policy that failed to update. + example: abc + required: + - id + example: + general: + status: 400 + title: Data Policy Update Failed + detail: Data policy with ID 'abc' update failed. + id: abc + type: https://hivemq.com/edge/api/model/DataPolicyUpdateFailureError + PolicyIdMismatchError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + - type: object + properties: + actualId: + type: string + description: The actual id. + example: id1 + expectedId: + type: string + description: The expected id. + example: id2 + required: + - actualId + - expectedId + example: + general: + status: 400 + title: Policy ID Mismatch + detail: The policy ID 'id1' in the request parameter does not match the policy ID 'id2' in the policy request body. + id: abc + type: https://hivemq.com/edge/api/model/PolicyIdMismatchError + PolicyInsufficientStorageError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + - type: object + properties: + id: + type: string + description: The policy id. + example: abc + required: + - id + example: + general: + status: 507 + title: Policy Insufficient Storage + detail: Policy with ID '123' could not be added because of insufficient server storage. + id: abc + type: https://hivemq.com/edge/api/model/PolicyInsufficientStorageError + PolicyNotFoundError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + - type: object + properties: + id: + type: string + description: The policy id. + example: abc + required: + - id + example: + general: + status: 404 + title: Policy Not Found + detail: Policy with ID 'abc' is not found. + id: abc + type: https://hivemq.com/edge/api/model/PolicyNotFoundError + SchemaAlreadyPresentError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + - type: object + properties: + id: + type: string + description: The schema id. + example: abc + required: + - id + example: + general: + status: 409 + title: Schema Already Present + detail: The given schema is already present as the latest version for the schema id 'abc'. + id: abc + type: https://hivemq.com/edge/api/model/SchemaAlreadyPresentError + SchemaEtagMismatchError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + - type: object + properties: + id: + type: string + description: The schema id. + example: abc + eTag: + type: string + description: The eTag. + example: 33a64df551425fcc55e4d42a148795d9f25f89d4 + required: + - id + example: + general: + status: 412 + title: Schema eTag Mismatch + detail: Schema with id 'abc' does not match the given etag '33a64df551425fcc55e4d42a148795d9f25f89d4'. + id: abc + eTag: 33a64df551425fcc55e4d42a148795d9f25f89d4 + type: https://hivemq.com/edge/api/model/SchemaEtagMismatchError + SchemaInsufficientStorageError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + - type: object + properties: + id: + type: string + description: The policy id. + example: abc + required: + - id + example: + general: + status: 507 + title: Schema Insufficient Storage + detail: Schema with ID '123' could not be added because of insufficient server storage. + id: abc + type: https://hivemq.com/edge/api/model/SchemaInsufficientStorageError + SchemaValidationError: + allOf: + - $ref: '#/components/schemas/ValidationError' + - oneOf: + - $ref: '#/components/schemas/EmptyFieldValidationError' + - $ref: '#/components/schemas/InvalidFieldLengthValidationError' + - $ref: '#/components/schemas/InvalidFieldValueValidationError' + - $ref: '#/components/schemas/InvalidIdentifierValidationError' + - $ref: '#/components/schemas/MissingFieldValidationError' + - $ref: '#/components/schemas/UnsupportedFieldValidationError' + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/EmptyFieldValidationError: '#/components/schemas/EmptyFieldValidationError' + https://hivemq.com/edge/api/model/InvalidFieldLengthValidationError: '#/components/schemas/InvalidFieldLengthValidationError' + https://hivemq.com/edge/api/model/InvalidFieldValueValidationError: '#/components/schemas/InvalidFieldValueValidationError' + https://hivemq.com/edge/api/model/InvalidIdentifierValidationError: '#/components/schemas/InvalidIdentifierValidationError' + https://hivemq.com/edge/api/model/MissingFieldValidationError: '#/components/schemas/MissingFieldValidationError' + https://hivemq.com/edge/api/model/UnsupportedFieldValidationError: '#/components/schemas/UnsupportedFieldValidationError' + SchemaInvalidErrors: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + - type: object + properties: + childErrors: + type: array + description: List of child validation errors. + items: + $ref: '#/components/schemas/SchemaValidationError' + required: + - childErrors + example: + general: + status: 400 + title: Schema Invalid + detail: Schema is invalid due to validation errors. + type: https://hivemq.com/edge/api/model/SchemaInvalidErrors + childErrors: + - detail: The length of script field '$.id' 1025 must be between 0 and 1024. + paths: $.id + value: aaa...aaa + actualLength: 1025 + expectedMinimumLength: 0 + expectedMaximumLength: 1024 + type: https://hivemq.com/edge/api/model/InvalidFieldLengthValidationError + SchemaNotFoundError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + - type: object + properties: + id: + type: string + description: The schema ID. + example: abc + required: + - id + example: + general: + status: 404 + title: Schema Not Found + detail: Schema with ID 'abc' is not found. + id: abc + type: https://hivemq.com/edge/api/model/SchemaNotFoundError + SchemaParsingFailureError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + - type: object + properties: + alias: + type: string + description: The schema alias. + example: abc + required: + - alias + example: + general: + status: 400 + title: Schema Parsing Failure + detail: The given schema 'abc' could not be parsed. + alias: abc + type: https://hivemq.com/edge/api/model/SchemaParsingFailureError + SchemaReferencedError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + - type: object + properties: + id: + type: string + description: The schema ID. + example: abc + required: + - id + example: + general: + status: 400 + title: Schema Referenced + detail: Schema with ID 'abc' is referenced. + id: abc + type: https://hivemq.com/edge/api/model/SchemaReferencedError + ScriptAlreadyPresentError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + - type: object + properties: + id: + type: string + description: The script id. + example: abc + required: + - id + example: + general: + status: 409 + title: Script Already Present + detail: The given script 'abc' is already present. + id: abc + type: https://hivemq.com/edge/api/model/ScriptAlreadyPresentError + ScriptCreationFailureError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + example: + general: + status: 400 + title: Script Creation Failure + detail: The given script could not be created. + type: https://hivemq.com/edge/api/model/ScriptCreationFailureError + ScriptEtagMismatchError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + - type: object + properties: + id: + type: string + description: The script id. + example: abc + eTag: + type: string + description: The eTag. + example: 33a64df551425fcc55e4d42a148795d9f25f89d4 + required: + - id + example: + general: + status: 412 + title: Script eTag Mismatch + detail: Script with id 'abc' does not match the given etag '33a64df551425fcc55e4d42a148795d9f25f89d4'. + id: abc + eTag: 33a64df551425fcc55e4d42a148795d9f25f89d4 + type: https://hivemq.com/edge/api/model/ScriptEtagMismatchError + ScriptInsufficientStorageError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + - type: object + properties: + id: + type: string + description: The policy id. + example: abc + required: + - id + example: + general: + status: 507 + title: Script Insufficient Storage + detail: Script with ID '123' could not be added because of insufficient server storage. + id: abc + type: https://hivemq.com/edge/api/model/ScriptInsufficientStorageError + ScriptValidationError: + allOf: + - $ref: '#/components/schemas/ValidationError' + - oneOf: + - $ref: '#/components/schemas/InvalidFieldLengthValidationError' + - $ref: '#/components/schemas/InvalidFieldValueValidationError' + - $ref: '#/components/schemas/InvalidIdentifierValidationError' + - $ref: '#/components/schemas/MissingFieldValidationError' + - $ref: '#/components/schemas/UnsupportedFieldValidationError' + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/InvalidFieldLengthValidationError: '#/components/schemas/InvalidFieldLengthValidationError' + https://hivemq.com/edge/api/model/InvalidFieldValueValidationError: '#/components/schemas/InvalidFieldValueValidationError' + https://hivemq.com/edge/api/model/InvalidIdentifierValidationError: '#/components/schemas/InvalidIdentifierValidationError' + https://hivemq.com/edge/api/model/MissingFieldValidationError: '#/components/schemas/MissingFieldValidationError' + https://hivemq.com/edge/api/model/UnsupportedFieldValidationError: '#/components/schemas/UnsupportedFieldValidationError' + ScriptInvalidErrors: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + - type: object + properties: + childErrors: + type: array + description: List of child validation errors. + items: + $ref: '#/components/schemas/ScriptValidationError' + required: + - childErrors + example: + general: + status: 400 + title: Script Invalid + detail: Script is invalid due to validation errors. + type: https://hivemq.com/edge/api/model/ScriptInvalidErrors + childErrors: + - detail: The length of script field '$.id' 1025 must be between 0 and 1024. + paths: $.id + value: aaa...aaa + actualLength: 1025 + expectedMinimumLength: 0 + expectedMaximumLength: 1024 + type: https://hivemq.com/edge/api/model/InvalidFieldLengthValidationError + ScriptNotFoundError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + - type: object + properties: + id: + type: string + description: The script ID. + example: abc + required: + - id + example: + general: + status: 404 + title: Script Not Found + detail: Script with ID 'abc' is not found. + id: abc + type: https://hivemq.com/edge/api/model/ScriptNotFoundError + ScriptParsingFailureError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + example: + general: + status: 400 + title: Script Parsing Failure + detail: The given script 'abc' could not be parsed. + type: https://hivemq.com/edge/api/model/ScriptParsingFailureError + ScriptReferencedError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + - type: object + properties: + id: + type: string + description: The script ID. + example: abc + required: + - id + example: + general: + status: 400 + title: Script Referenced + detail: Script with ID 'abc' is referenced. + id: abc + type: https://hivemq.com/edge/api/model/ScriptReferencedError + ScriptSanitationFailureError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + example: + general: + status: 400 + title: Script Sanitation Failure + detail: The given script could not be sanitized. + type: https://hivemq.com/edge/api/model/ScriptSanitationFailureError + TopicFilterMismatchError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + - type: object + properties: + path: + type: string + description: The json path of the topic filter. + example: $.filter + required: + - path + example: + general: + status: 400 + title: Topic Filter Mismatch + detail: The topic filter '$.filter' mismatches. + type: https://hivemq.com/edge/api/model/TopicFilterMismatchError + InsufficientStorageError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + example: + general: + status: 507 + title: Insufficient Storage + detail: Insufficient Storage. + type: https://hivemq.com/edge/api/model/InsufficientStorageError + InternalServerError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + example: + general: + status: 500 + title: Internal Server Error + detail: An unexpected error occurred, check the logs. + type: https://hivemq.com/edge/api/model/InternalServerError + creation: + status: 500 + title: Internal Server Error + detail: 'An unexpected error occurred: Exception during creation of the Json Schema for functions.' + type: https://hivemq.com/edge/api/model/InternalServerError + InvalidQueryParameterError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + - type: object + properties: + parameter: + type: string + description: The query parameter. + required: + - parameter + example: + general: + status: 400 + title: Query Parameter is Invalid + detail: 'Query parameter ''a'' is invalid: ''a'' could not be parsed.' + parameter: a + type: https://hivemq.com/edge/api/model/InvalidQueryParameterError + PreconditionFailedError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + example: + general: + status: 412 + title: Precondition Failed + detail: 'A precondition required for fulfilling the request was not fulfilled: Policy does not match the given etag ''abc''.' + type: https://hivemq.com/edge/api/model/PreconditionFailedError + RequestBodyMissingError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + example: + general: + status: 400 + title: Required Request Body Missing + detail: Required request body is missing. + type: https://hivemq.com/edge/api/model/RequestBodyMissingError + RequestBodyParameterMissingError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + - type: object + properties: + parameter: + type: string + description: The the missing request body parameter. + required: + - parameter + example: + general: + status: 400 + title: Required Request Body Parameter Missing + detail: Required request body parameter 'a' is missing. + parameter: a + type: https://hivemq.com/edge/api/model/RequestBodyParameterMissingError + TemporaryNotAvailableError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + example: + general: + status: 503 + title: Endpoint Temporarily not Available + detail: The endpoint is temporarily not available, please try again later. + type: https://hivemq.com/edge/api/model/TemporaryNotAvailableError + UrlParameterMissingError: + allOf: + - $ref: '#/components/schemas/ApiProblemDetails' + - type: object + properties: + parameter: + type: string + description: The name of the missing parameter. + required: + - parameter + example: + general: + status: 400 + title: Required URL Parameter Missing + detail: Required URL parameter 'a' is missing. + parameter: a + type: https://hivemq.com/edge/api/model/UrlParameterMissingError + JsonNode: + type: object + description: The arguments of the fsm derived from the behavior policy. + FsmStateInformationItem: + type: object + description: List of result items that are returned by this endpoint + properties: + arguments: + $ref: '#/components/schemas/JsonNode' + behaviorId: + type: string + description: The unique identifier of the policy. + firstSetAt: + type: string + description: The timestamp when this state was set the first time. + policyId: + type: string + description: The unique identifier of the policy. + stateName: type: string description: The name of the fsm state. stateType: @@ -5201,8 +6650,6 @@ components: description: List of result items that are returned by this endpoint items: $ref: '#/components/schemas/DataPolicy' - Errors: - type: object PolicyType: description: The type of policy in Data Hub type: string diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index f3affdac3f..e17aeefab5 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -13,6 +13,7 @@ digitalpetri-modbus-tcp = "2.1.0" dropwizard-metrics = "4.2.33" equalsverifier = "3.17.5" errorprone = "2.38.0" +freemarker = "2.3.34" future-converter = "1.2.0" guava = "33.4.8-jre" hikari = "6.2.1" @@ -91,6 +92,7 @@ dropwizard-metrics-jvm = { module = "io.dropwizard.metrics:metrics-jvm", version dropwizard-metrics-logback = { module = "io.dropwizard.metrics:metrics-logback", version.ref = "dropwizard-metrics" } equalsverifier = { module = "nl.jqno.equalsverifier:equalsverifier", version.ref = "equalsverifier" } errorprone = { module = "com.google.errorprone:error_prone_core", version.ref = "errorprone" } +freemarker = { module = "org.freemarker:freemarker", version.ref = "freemarker" } json-schema-inferrer = { module = "com.github.saasquatch:json-schema-inferrer", version.ref = "json-schema-inferrer" } jersey-container-jdk-http = { module = "org.glassfish.jersey.containers:jersey-container-jdk-http", version.ref = "jersey" } jersey-hk2 = { module = "org.glassfish.jersey.inject:jersey-hk2", version.ref = "jersey" } diff --git a/hivemq-edge-frontend/src/api/hooks/useHttpClient/useHttpClient.ts b/hivemq-edge-frontend/src/api/hooks/useHttpClient/useHttpClient.ts index 1c8ba9ee62..4efbc8f074 100644 --- a/hivemq-edge-frontend/src/api/hooks/useHttpClient/useHttpClient.ts +++ b/hivemq-edge-frontend/src/api/hooks/useHttpClient/useHttpClient.ts @@ -63,6 +63,9 @@ export const useHttpClient = () => { { BASE: config.apiBaseUrl, TOKEN: credentials?.token, + HEADERS: { + Accept: 'application/json, application/problem+json', + }, }, AxiosHttpRequestWithInterceptors ) diff --git a/hivemq-edge-frontend/src/extensions/datahub/hooks/useGetFilteredFunctions.tsx b/hivemq-edge-frontend/src/extensions/datahub/hooks/useGetFilteredFunctions.tsx new file mode 100644 index 0000000000..2ee8a2c742 --- /dev/null +++ b/hivemq-edge-frontend/src/extensions/datahub/hooks/useGetFilteredFunctions.tsx @@ -0,0 +1,66 @@ +import { useMemo } from 'react' + +import { BehaviorPolicyTransitionEvent, type FunctionSpecs } from '@/api/__generated__' +import { DataHubNodeType } from '@datahub/types.ts' +import { useGetAllFunctionSpecs } from '@datahub/api/hooks/DataHubFunctionsService/useGetAllFunctionSpecs.ts' + +export const MqttTransformFunction: FunctionSpecs = { + functionId: 'DataHub.transform', + metadata: { + inLicenseAllowed: true, + isTerminal: false, + isDataOnly: false, + hasArguments: true, + supportedEvents: [ + BehaviorPolicyTransitionEvent.EVENT_ON_ANY, + BehaviorPolicyTransitionEvent.MQTT_ON_INBOUND_CONNECT, + BehaviorPolicyTransitionEvent.MQTT_ON_INBOUND_PUBLISH, + BehaviorPolicyTransitionEvent.MQTT_ON_INBOUND_SUBSCRIBE, + BehaviorPolicyTransitionEvent.MQTT_ON_INBOUND_DISCONNECT, + BehaviorPolicyTransitionEvent.CONNECTION_ON_DISCONNECT, + ], + }, + schema: { + title: 'Transformation', + description: + 'The list of Javascript functions used in this transformation operation. Add them directly on the graph', + properties: { + transform: { + type: 'array', + title: 'Execution order', + description: 'Change the order in which the transform functions will be executed', + items: { + type: 'string', + title: 'Function name', + }, + }, + }, + }, +} + +export const useGetFilteredFunction = ( + type: DataHubNodeType = DataHubNodeType.DATA_POLICY, + transition?: BehaviorPolicyTransitionEvent +) => { + const { isError, error, isLoading, isSuccess, data } = useGetAllFunctionSpecs() + + const filteredFunctions = useMemo(() => { + if (!data || !data.items?.length) return [] + + return data.items.filter((functionSpec) => { + if (!functionSpec.metadata.inLicenseAllowed) return false + if ( + functionSpec.metadata.supportedEvents?.length && + transition && + !functionSpec.metadata.supportedEvents.includes(transition) + ) + return false + if (functionSpec.metadata.isDataOnly && type !== DataHubNodeType.DATA_POLICY) return false + + // In all other cases, the function is valid + return true + }) + }, [data, transition, type]) + + return { data: [...filteredFunctions, MqttTransformFunction], isError, error, isLoading, isSuccess } +} diff --git a/hivemq-edge-openapi/openapi/components/schemas/ProblemDetails.yaml b/hivemq-edge-openapi/openapi/components/schemas/ProblemDetails.yaml index b28f26b508..edb3c5924c 100644 --- a/hivemq-edge-openapi/openapi/components/schemas/ProblemDetails.yaml +++ b/hivemq-edge-openapi/openapi/components/schemas/ProblemDetails.yaml @@ -6,6 +6,7 @@ properties: detail: type: string errors: + deprecated: true type: array items: $ref: ./Error.yaml diff --git a/hivemq-edge-openapi/openapi/components/schemas/errors/ApiProblemDetails.yaml b/hivemq-edge-openapi/openapi/components/schemas/errors/ApiProblemDetails.yaml new file mode 100644 index 0000000000..1f929c1023 --- /dev/null +++ b/hivemq-edge-openapi/openapi/components/schemas/errors/ApiProblemDetails.yaml @@ -0,0 +1,54 @@ +allOf: + - $ref: "../ProblemDetails.yaml" + - type: object + required: + - detail + - status + - type +discriminator: + propertyName: type + mapping: + # DataHub + https://hivemq.com/edge/api/model/BehaviorPolicyAlreadyPresentError: "./datahub/BehaviorPolicyAlreadyPresentError.yaml" + https://hivemq.com/edge/api/model/BehaviorPolicyCreationFailureError: "./datahub/BehaviorPolicyCreationFailureError.yaml" + https://hivemq.com/edge/api/model/BehaviorPolicyInvalidErrors: "./datahub/BehaviorPolicyInvalidErrors.yaml" + https://hivemq.com/edge/api/model/BehaviorPolicyNotFoundError: "./datahub/BehaviorPolicyNotFoundError.yaml" + https://hivemq.com/edge/api/model/BehaviorPolicyRejectedError: "./datahub/BehaviorPolicyRejectedError.yaml" + https://hivemq.com/edge/api/model/BehaviorPolicyUpdateFailureError: "./datahub/BehaviorPolicyUpdateFailureError.yaml" + https://hivemq.com/edge/api/model/ClientDisconnectedError: "./datahub/ClientDisconnectedError.yaml" + https://hivemq.com/edge/api/model/ClientNotFoundError: "./datahub/ClientNotFoundError.yaml" + https://hivemq.com/edge/api/model/DataPolicyAlreadyPresentError: "./datahub/DataPolicyAlreadyPresentError.yaml" + https://hivemq.com/edge/api/model/DataPolicyCreationFailureError: "./datahub/DataPolicyCreationFailureError.yaml" + https://hivemq.com/edge/api/model/DataPolicyInvalidErrors: "./datahub/DataPolicyInvalidErrors.yaml" + https://hivemq.com/edge/api/model/DataPolicyNotFoundError: "./datahub/DataPolicyNotFoundError.yaml" + https://hivemq.com/edge/api/model/DataPolicyRejectedError: "./datahub/DataPolicyRejectedError.yaml" + https://hivemq.com/edge/api/model/DataPolicyUpdateFailureError: "./datahub/DataPolicyUpdateFailureError.yaml" + https://hivemq.com/edge/api/model/PolicyIdMismatchError: "./datahub/PolicyIdMismatchError.yaml" + https://hivemq.com/edge/api/model/PolicyInsufficientStorageError: "./datahub/PolicyInsufficientStorageError.yaml" + https://hivemq.com/edge/api/model/PolicyNotFoundError: "./datahub/PolicyNotFoundError.yaml" + https://hivemq.com/edge/api/model/SchemaAlreadyPresentError: "./datahub/SchemaAlreadyPresentError.yaml" + https://hivemq.com/edge/api/model/SchemaEtagMismatchError: "./datahub/SchemaEtagMismatchError.yaml" + https://hivemq.com/edge/api/model/SchemaInsufficientStorageError: "./datahub/SchemaInsufficientStorageError.yaml" + https://hivemq.com/edge/api/model/SchemaInvalidErrors: "./datahub/SchemaInvalidErrors.yaml" + https://hivemq.com/edge/api/model/SchemaNotFoundError: "./datahub/SchemaNotFoundError.yaml" + https://hivemq.com/edge/api/model/SchemaParsingFailureError: "./datahub/SchemaParsingFailureError.yaml" + https://hivemq.com/edge/api/model/SchemaReferencedError: "./datahub/SchemaReferencedError.yaml" + https://hivemq.com/edge/api/model/ScriptAlreadyPresentError: "./datahub/ScriptAlreadyPresentError.yaml" + https://hivemq.com/edge/api/model/ScriptCreationFailureError: "./datahub/ScriptCreationFailureError.yaml" + https://hivemq.com/edge/api/model/ScriptEtagMismatchError: "./datahub/ScriptEtagMismatchError.yaml" + https://hivemq.com/edge/api/model/ScriptInsufficientStorageError: "./datahub/ScriptInsufficientStorageError.yaml" + https://hivemq.com/edge/api/model/ScriptInvalidErrors: "./datahub/ScriptInvalidErrors.yaml" + https://hivemq.com/edge/api/model/ScriptNotFoundError: "./datahub/ScriptNotFoundError.yaml" + https://hivemq.com/edge/api/model/ScriptParsingFailureError: "./datahub/ScriptParsingFailureError.yaml" + https://hivemq.com/edge/api/model/ScriptReferencedError: "./datahub/ScriptReferencedError.yaml" + https://hivemq.com/edge/api/model/ScriptSanitationFailureError: "./datahub/ScriptSanitationFailureError.yaml" + https://hivemq.com/edge/api/model/TopicFilterMismatchError: "./datahub/TopicFilterMismatchError.yaml" + # HTTP + https://hivemq.com/edge/api/model/InsufficientStorageError: "./http/InsufficientStorageError.yaml" + https://hivemq.com/edge/api/model/InternalServerError: "./http/InternalServerError.yaml" + https://hivemq.com/edge/api/model/InvalidQueryParameterError: "./http/InvalidQueryParameterError.yaml" + https://hivemq.com/edge/api/model/PreconditionFailedError: "./http/PreconditionFailedError.yaml" + https://hivemq.com/edge/api/model/RequestBodyMissingError: "./http/RequestBodyMissingError.yaml" + https://hivemq.com/edge/api/model/RequestBodyParameterMissingError: "./http/RequestBodyParameterMissingError.yaml" + https://hivemq.com/edge/api/model/TemporaryNotAvailableError: "./http/TemporaryNotAvailableError.yaml" + https://hivemq.com/edge/api/model/UrlParameterMissingError: "./http/UrlParameterMissingError.yaml" diff --git a/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/AtMostOneFunctionValidationError.yaml b/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/AtMostOneFunctionValidationError.yaml new file mode 100644 index 0000000000..7f2c5f6443 --- /dev/null +++ b/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/AtMostOneFunctionValidationError.yaml @@ -0,0 +1,38 @@ +allOf: + - $ref: "../validation/ValidationError.yaml" + - type: object + properties: + function: + type: string + description: The function. + example: "function1" + occurrences: + type: integer + format: int32 + description: The occurrences of the function. + minimum: 0 + example: 3 + paths: + type: array + items: + type: string + format: json-path + description: The json paths where the function occurs. + example: + - "$.path1" + - "$.path2" + - "$.path3" + required: + - function + - occurrences + - paths +example: + general: + detail: "The pipeline must contain at most one 'function1' function, but 3 were found at ['$.path1', '$.path2', '$.path3']." + function: "function1" + occurrences: 3 + paths: + - "$.path1" + - "$.path2" + - "$.path3" + type: "https://hivemq.com/edge/api/model/AtMostOneFunctionValidationError" diff --git a/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/BehaviorPolicyAlreadyPresentError.yaml b/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/BehaviorPolicyAlreadyPresentError.yaml new file mode 100644 index 0000000000..cf85a81c5b --- /dev/null +++ b/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/BehaviorPolicyAlreadyPresentError.yaml @@ -0,0 +1,17 @@ +allOf: + - $ref: "../ApiProblemDetails.yaml" + - type: object + properties: + id: + type: string + description: The behavior policy id. + example: "abc" + required: + - id +example: + general: + status: 409 + title: "Behavior Policy Already Present" + detail: "The given behavior policy 'abc' is already present." + id: "abc" + type: "https://hivemq.com/edge/api/model/BehaviorPolicyAlreadyPresentError" diff --git a/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/BehaviorPolicyCreationFailureError.yaml b/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/BehaviorPolicyCreationFailureError.yaml new file mode 100644 index 0000000000..ce4e167035 --- /dev/null +++ b/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/BehaviorPolicyCreationFailureError.yaml @@ -0,0 +1,8 @@ +allOf: + - $ref: "../ApiProblemDetails.yaml" +example: + general: + status: 400 + title: "Behavior Policy Creation Failed" + detail: "Behavior policy creation failed: The policy was rejected." + type: "https://hivemq.com/edge/api/model/BehaviorPolicyCreationFailureError" diff --git a/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/BehaviorPolicyInvalidErrors.yaml b/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/BehaviorPolicyInvalidErrors.yaml new file mode 100644 index 0000000000..6d71f63f4a --- /dev/null +++ b/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/BehaviorPolicyInvalidErrors.yaml @@ -0,0 +1,24 @@ +allOf: + - $ref: "../ApiProblemDetails.yaml" + - type: object + properties: + childErrors: + type: array + description: List of child validation errors. + items: + $ref: "./BehaviorPolicyValidationError.yaml" + required: + - childErrors +example: + general: + status: 400 + title: "Behavior Policy Invalid" + detail: "Behavior policy is invalid due to validation errors." + type: "https://hivemq.com/edge/api/model/BehaviorPolicyInvalidErrors" + childErrors: + - detail: "The transition from state 'state1' to state 'state2' on event 'event1' in '$.path' is not defined for behavior 'id1'." + fromState: "state1" + toState: "state2" + path: "$.path" + id: "id1" + type: "https://hivemq.com/edge/api/model/IllegalEventTransitionValidationError" diff --git a/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/BehaviorPolicyNotFoundError.yaml b/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/BehaviorPolicyNotFoundError.yaml new file mode 100644 index 0000000000..4c022e0279 --- /dev/null +++ b/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/BehaviorPolicyNotFoundError.yaml @@ -0,0 +1,17 @@ +allOf: + - $ref: "../ApiProblemDetails.yaml" + - type: object + properties: + id: + type: string + description: The data policy id. + example: "abc" + required: + - id +example: + general: + status: 404 + title: "Behavior Policy Not Found" + detail: "Behavior policy with ID 'abc' is not found." + id: "abc" + type: "https://hivemq.com/edge/api/model/BehaviorPolicyNotFoundError" diff --git a/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/BehaviorPolicyRejectedError.yaml b/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/BehaviorPolicyRejectedError.yaml new file mode 100644 index 0000000000..f5a6f08f61 --- /dev/null +++ b/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/BehaviorPolicyRejectedError.yaml @@ -0,0 +1,8 @@ +allOf: + - $ref: "../ApiProblemDetails.yaml" +example: + general: + status: 400 + title: "Behavior Policy Rejected" + detail: "Behavior policy is rejected." + type: "https://hivemq.com/edge/api/model/BehaviorPolicyRejectedError" diff --git a/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/BehaviorPolicyUpdateFailureError.yaml b/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/BehaviorPolicyUpdateFailureError.yaml new file mode 100644 index 0000000000..d0cfaafe69 --- /dev/null +++ b/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/BehaviorPolicyUpdateFailureError.yaml @@ -0,0 +1,17 @@ +allOf: + - $ref: "../ApiProblemDetails.yaml" + - type: object + properties: + id: + type: string + description: The ID of the policy that failed to update. + example: "abc" + required: + - id +example: + general: + status: 400 + title: "Behavior Policy Update Failed" + detail: "Behavior policy with ID 'abc' update failed." + id: "abc" + type: "https://hivemq.com/edge/api/model/BehaviorPolicyUpdateFailureError" diff --git a/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/BehaviorPolicyValidationError.yaml b/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/BehaviorPolicyValidationError.yaml new file mode 100644 index 0000000000..87fb6ae826 --- /dev/null +++ b/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/BehaviorPolicyValidationError.yaml @@ -0,0 +1,26 @@ +allOf: + - $ref: "../validation/ValidationError.yaml" + - oneOf: + - $ref: "./IllegalEventTransitionValidationError.yaml" + - $ref: "./IllegalFunctionValidationError.yaml" + - $ref: "./InvalidSchemaVersionValidationError.yaml" + - $ref: "../validation/AtLeastOneFieldMissingValidationError.yaml" + - $ref: "../validation/EmptyFieldValidationError.yaml" + - $ref: "../validation/InvalidFieldLengthValidationError.yaml" + - $ref: "../validation/InvalidFieldValueValidationError.yaml" + - $ref: "../validation/InvalidIdentifierValidationError.yaml" + - $ref: "../validation/MissingFieldValidationError.yaml" + - $ref: "../validation/UnsupportedFieldValidationError.yaml" +discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/AtLeastOneFieldMissingValidationError: "../validation/AtLeastOneFieldMissingValidationError.yaml" + https://hivemq.com/edge/api/model/EmptyFieldValidationError: "../validation/EmptyFieldValidationError.yaml" + https://hivemq.com/edge/api/model/IllegalEventTransitionValidationError: "./IllegalEventTransitionValidationError.yaml" + https://hivemq.com/edge/api/model/IllegalFunctionValidationError: "./IllegalFunctionValidationError.yaml" + https://hivemq.com/edge/api/model/InvalidFieldLengthValidationError: "../validation/InvalidFieldLengthValidationError.yaml" + https://hivemq.com/edge/api/model/InvalidFieldValueValidationError: "../validation/InvalidFieldValueValidationError.yaml" + https://hivemq.com/edge/api/model/InvalidIdentifierValidationError: "../validation/InvalidIdentifierValidationError.yaml" + https://hivemq.com/edge/api/model/InvalidSchemaVersionValidationError: "./InvalidSchemaVersionValidationError.yaml" + https://hivemq.com/edge/api/model/MissingFieldValidationError: "../validation/MissingFieldValidationError.yaml" + https://hivemq.com/edge/api/model/UnsupportedFieldValidationError: "../validation/UnsupportedFieldValidationError.yaml" diff --git a/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/ClientDisconnectedError.yaml b/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/ClientDisconnectedError.yaml new file mode 100644 index 0000000000..89d7e92e3c --- /dev/null +++ b/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/ClientDisconnectedError.yaml @@ -0,0 +1,17 @@ +allOf: + - $ref: "../ApiProblemDetails.yaml" + - type: object + properties: + id: + type: string + description: The client id. + example: "abc" + required: + - id +example: + general: + status: 404 + title: "Client Disconnected" + detail: "Client with ID 'abc' is disconnected." + id: "abc" + type: "https://hivemq.com/edge/api/model/ClientDisconnectedError" diff --git a/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/ClientNotFoundError.yaml b/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/ClientNotFoundError.yaml new file mode 100644 index 0000000000..8889727ecc --- /dev/null +++ b/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/ClientNotFoundError.yaml @@ -0,0 +1,17 @@ +allOf: + - $ref: "../ApiProblemDetails.yaml" + - type: object + properties: + id: + type: string + description: The client id. + example: "abc" + required: + - id +example: + general: + status: 404 + title: "Client Not Found" + detail: "Client with ID 'abc' is not found." + id: "abc" + type: "https://hivemq.com/edge/api/model/ClientNotFoundError" diff --git a/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/DataPolicyAlreadyPresentError.yaml b/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/DataPolicyAlreadyPresentError.yaml new file mode 100644 index 0000000000..f37ab54ace --- /dev/null +++ b/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/DataPolicyAlreadyPresentError.yaml @@ -0,0 +1,17 @@ +allOf: + - $ref: "../ApiProblemDetails.yaml" + - type: object + properties: + id: + type: string + description: The data policy id. + example: "abc" + required: + - id +example: + general: + status: 409 + title: "Data Policy Already Present" + detail: "The given data policy 'abc' is already present." + id: "abc" + type: "https://hivemq.com/edge/api/model/DataPolicyAlreadyPresentError" diff --git a/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/DataPolicyCreationFailureError.yaml b/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/DataPolicyCreationFailureError.yaml new file mode 100644 index 0000000000..ccca26e8d8 --- /dev/null +++ b/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/DataPolicyCreationFailureError.yaml @@ -0,0 +1,8 @@ +allOf: + - $ref: "../ApiProblemDetails.yaml" +example: + general: + status: 400 + title: "Data Policy Creation Failed" + detail: "Data policy creation failed: The policy was rejected." + type: "https://hivemq.com/edge/api/model/DataPolicyCreationFailureError" diff --git a/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/DataPolicyInvalidErrors.yaml b/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/DataPolicyInvalidErrors.yaml new file mode 100644 index 0000000000..6dd694a3f7 --- /dev/null +++ b/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/DataPolicyInvalidErrors.yaml @@ -0,0 +1,26 @@ +allOf: + - $ref: "../ApiProblemDetails.yaml" + - type: object + properties: + childErrors: + type: array + description: List of child validation errors. + items: + $ref: "./DataPolicyValidationError.yaml" + required: + - childErrors +example: + general: + status: 400 + title: "Data Policy Invalid" + detail: "Data policy is invalid due to validation errors." + type: "https://hivemq.com/edge/api/model/DataPolicyInvalidErrors" + childErrors: + - detail: "The pipeline must contain at most one 'function1' function, but 3 were found at ['$.path1', '$.path2', '$.path3']." + function: "function1" + occurrences: 3 + paths: + - "$.path1" + - "$.path2" + - "$.path3" + type: "https://hivemq.com/edge/api/model/AtMostOneFunctionValidationError" diff --git a/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/DataPolicyNotFoundError.yaml b/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/DataPolicyNotFoundError.yaml new file mode 100644 index 0000000000..6324c4ebe8 --- /dev/null +++ b/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/DataPolicyNotFoundError.yaml @@ -0,0 +1,17 @@ +allOf: + - $ref: "../ApiProblemDetails.yaml" + - type: object + properties: + id: + type: string + description: The data policy id. + example: "abc" + required: + - id +example: + general: + status: 404 + title: "Data Policy Not Found" + detail: "Data policy with ID 'abc' is not found." + id: "abc" + type: "https://hivemq.com/edge/api/model/DataPolicyNotFoundError" diff --git a/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/DataPolicyRejectedError.yaml b/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/DataPolicyRejectedError.yaml new file mode 100644 index 0000000000..4dde36aa3c --- /dev/null +++ b/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/DataPolicyRejectedError.yaml @@ -0,0 +1,8 @@ +allOf: + - $ref: "../ApiProblemDetails.yaml" +example: + general: + status: 400 + title: "Data Policy Rejected" + detail: "Data policy is rejected." + type: "https://hivemq.com/edge/api/model/DataPolicyRejectedError" diff --git a/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/DataPolicyUpdateFailureError.yaml b/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/DataPolicyUpdateFailureError.yaml new file mode 100644 index 0000000000..ac3cd5832f --- /dev/null +++ b/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/DataPolicyUpdateFailureError.yaml @@ -0,0 +1,17 @@ +allOf: + - $ref: "../ApiProblemDetails.yaml" + - type: object + properties: + id: + type: string + description: The ID of the policy that failed to update. + example: "abc" + required: + - id +example: + general: + status: 400 + title: "Data Policy Update Failed" + detail: "Data policy with ID 'abc' update failed." + id: "abc" + type: "https://hivemq.com/edge/api/model/DataPolicyUpdateFailureError" diff --git a/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/DataPolicyValidationError.yaml b/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/DataPolicyValidationError.yaml new file mode 100644 index 0000000000..70cd1d0d8e --- /dev/null +++ b/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/DataPolicyValidationError.yaml @@ -0,0 +1,28 @@ +allOf: + - $ref: "../validation/ValidationError.yaml" + - oneOf: + - $ref: "./AtMostOneFunctionValidationError.yaml" + - $ref: "./FunctionMustBePairedValidationError.yaml" + - $ref: "./InvalidFunctionOrderValidationError.yaml" + - $ref: "./InvalidSchemaVersionValidationError.yaml" + - $ref: "./UnknownVariableValidationError.yaml" + - $ref: "../validation/EmptyFieldValidationError.yaml" + - $ref: "../validation/InvalidFieldLengthValidationError.yaml" + - $ref: "../validation/InvalidFieldValueValidationError.yaml" + - $ref: "../validation/InvalidIdentifierValidationError.yaml" + - $ref: "../validation/MissingFieldValidationError.yaml" + - $ref: "../validation/UnsupportedFieldValidationError.yaml" +discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/AtMostOneFunctionValidationError: "./AtMostOneFunctionValidationError.yaml" + https://hivemq.com/edge/api/model/EmptyFieldValidationError: "../validation/EmptyFieldValidationError.yaml" + https://hivemq.com/edge/api/model/FunctionMustBePairedValidationError: "./FunctionMustBePairedValidationError.yaml" + https://hivemq.com/edge/api/model/InvalidFieldLengthValidationError: "../validation/InvalidFieldLengthValidationError.yaml" + https://hivemq.com/edge/api/model/InvalidFieldValueValidationError: "../validation/InvalidFieldValueValidationError.yaml" + https://hivemq.com/edge/api/model/InvalidFunctionOrderValidationError: "./InvalidFunctionOrderValidationError.yaml" + https://hivemq.com/edge/api/model/InvalidIdentifierValidationError: "../validation/InvalidIdentifierValidationError.yaml" + https://hivemq.com/edge/api/model/InvalidSchemaVersionValidationError: "./InvalidSchemaVersionValidationError.yaml" + https://hivemq.com/edge/api/model/MissingFieldValidationError: "../validation/MissingFieldValidationError.yaml" + https://hivemq.com/edge/api/model/UnknownVariableValidationError: "./UnknownVariableValidationError.yaml" + https://hivemq.com/edge/api/model/UnsupportedFieldValidationError: "../validation/UnsupportedFieldValidationError.yaml" diff --git a/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/FunctionMustBePairedValidationError.yaml b/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/FunctionMustBePairedValidationError.yaml new file mode 100644 index 0000000000..6c1df9934e --- /dev/null +++ b/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/FunctionMustBePairedValidationError.yaml @@ -0,0 +1,21 @@ +allOf: + - $ref: "../validation/ValidationError.yaml" + - type: object + properties: + existingFunction: + type: string + description: The existing function. + example: "function1" + missingFunction: + type: string + description: The missing function. + example: "function2" + required: + - existingFunction + - missingFunction +example: + general: + detail: "If 'function1' function is present in the pipeline, 'function2' function must be present as well." + existingFunction: "function1" + missingFunction: "function2" + type: "https://hivemq.com/edge/api/model/FunctionMustBePairedValidationError" diff --git a/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/IllegalEventTransitionValidationError.yaml b/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/IllegalEventTransitionValidationError.yaml new file mode 100644 index 0000000000..93aef476cf --- /dev/null +++ b/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/IllegalEventTransitionValidationError.yaml @@ -0,0 +1,39 @@ +allOf: + - $ref: "../validation/ValidationError.yaml" + - type: object + properties: + event: + type: string + description: The event name. + example: "event1" + fromState: + type: string + description: The event from state. + example: "state1" + id: + type: string + description: The event id. + example: "abc" + path: + type: string + description: The path. + example: "$.event" + toState: + type: string + description: The event to state. + example: "state2" + required: + - event + - fromState + - id + - path + - toState +example: + general: + detail: "The transition from state 'state1' to state 'state2' on event 'event1' in '$.event' is not defined for behavior 'abc'." + event: "event1" + fromState: "state1" + toState: "state2" + id: "abc" + path: "$.event" + type: "https://hivemq.com/edge/api/model/IllegalEventTransitionValidationError" diff --git a/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/IllegalFunctionValidationError.yaml b/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/IllegalFunctionValidationError.yaml new file mode 100644 index 0000000000..d5ed1baee5 --- /dev/null +++ b/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/IllegalFunctionValidationError.yaml @@ -0,0 +1,28 @@ +allOf: + - $ref: "../validation/ValidationError.yaml" + - type: object + properties: + event: + type: string + description: The event name. + example: "event1" + id: + type: string + description: The function id. + example: "abc" + path: + type: string + format: json-path + description: The json path. + example: "$.event" + required: + - event + - id + - path +example: + general: + detail: "The function 'abc' is not allowed for event 'event1' in '$.event'." + event: "event1" + id: "abc" + path: "$.event" + type: "https://hivemq.com/edge/api/model/IllegalFunctionValidationError" diff --git a/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/InvalidFunctionOrderValidationError.yaml b/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/InvalidFunctionOrderValidationError.yaml new file mode 100644 index 0000000000..48f359a2d6 --- /dev/null +++ b/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/InvalidFunctionOrderValidationError.yaml @@ -0,0 +1,28 @@ +allOf: + - $ref: "../validation/ValidationError.yaml" + - type: object + properties: + function: + type: string + description: The function. + example: "transform" + path: + type: string + format: json-path + description: The json path. + example: "$.path" + previousFunction: + type: string + description: The previous function. + example: "init" + required: + - function + - path + - previousFunction +example: + general: + detail: "The operation at '$.path' with the functionId 'transform' must be after a 'init' operation." + function: "transform" + path: "$.path" + previousFunction: "init" + type: "https://hivemq.com/edge/api/model/InvalidFunctionOrderValidationError" diff --git a/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/InvalidSchemaVersionValidationError.yaml b/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/InvalidSchemaVersionValidationError.yaml new file mode 100644 index 0000000000..e1c8c2221b --- /dev/null +++ b/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/InvalidSchemaVersionValidationError.yaml @@ -0,0 +1,21 @@ +allOf: + - $ref: "../validation/ValidationError.yaml" + - type: object + properties: + id: + type: string + description: The schema id. + example: "abc" + version: + type: string + description: The schema version. + example: "2" + required: + - id + - version +example: + general: + detail: "The referenced schema with id 'abc' and version '2' was not found." + id: "abc" + version: "2" + type: "https://hivemq.com/edge/api/model/InvalidSchemaVersionValidationError" diff --git a/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/PolicyIdMismatchError.yaml b/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/PolicyIdMismatchError.yaml new file mode 100644 index 0000000000..6b68f57751 --- /dev/null +++ b/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/PolicyIdMismatchError.yaml @@ -0,0 +1,22 @@ +allOf: + - $ref: "../ApiProblemDetails.yaml" + - type: object + properties: + actualId: + type: string + description: The actual id. + example: "id1" + expectedId: + type: string + description: The expected id. + example: "id2" + required: + - actualId + - expectedId +example: + general: + status: 400 + title: "Policy ID Mismatch" + detail: "The policy ID 'id1' in the request parameter does not match the policy ID 'id2' in the policy request body." + id: "abc" + type: "https://hivemq.com/edge/api/model/PolicyIdMismatchError" diff --git a/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/PolicyInsufficientStorageError.yaml b/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/PolicyInsufficientStorageError.yaml new file mode 100644 index 0000000000..6ed78b8ab9 --- /dev/null +++ b/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/PolicyInsufficientStorageError.yaml @@ -0,0 +1,17 @@ +allOf: + - $ref: "../ApiProblemDetails.yaml" + - type: object + properties: + id: + type: string + description: The policy id. + example: "abc" + required: + - id +example: + general: + status: 507 + title: "Policy Insufficient Storage" + detail: "Policy with ID '123' could not be added because of insufficient server storage." + id: "abc" + type: "https://hivemq.com/edge/api/model/PolicyInsufficientStorageError" diff --git a/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/PolicyNotFoundError.yaml b/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/PolicyNotFoundError.yaml new file mode 100644 index 0000000000..f200cc7acf --- /dev/null +++ b/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/PolicyNotFoundError.yaml @@ -0,0 +1,17 @@ +allOf: + - $ref: "../ApiProblemDetails.yaml" + - type: object + properties: + id: + type: string + description: The policy id. + example: "abc" + required: + - id +example: + general: + status: 404 + title: "Policy Not Found" + detail: "Policy with ID 'abc' is not found." + id: "abc" + type: "https://hivemq.com/edge/api/model/PolicyNotFoundError" diff --git a/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/SchemaAlreadyPresentError.yaml b/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/SchemaAlreadyPresentError.yaml new file mode 100644 index 0000000000..e4e8bf878e --- /dev/null +++ b/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/SchemaAlreadyPresentError.yaml @@ -0,0 +1,17 @@ +allOf: + - $ref: "../ApiProblemDetails.yaml" + - type: object + properties: + id: + type: string + description: The schema id. + example: "abc" + required: + - id +example: + general: + status: 409 + title: "Schema Already Present" + detail: "The given schema is already present as the latest version for the schema id 'abc'." + id: "abc" + type: "https://hivemq.com/edge/api/model/SchemaAlreadyPresentError" diff --git a/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/SchemaEtagMismatchError.yaml b/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/SchemaEtagMismatchError.yaml new file mode 100644 index 0000000000..e0d25107a2 --- /dev/null +++ b/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/SchemaEtagMismatchError.yaml @@ -0,0 +1,22 @@ +allOf: + - $ref: "../ApiProblemDetails.yaml" + - type: object + properties: + id: + type: string + description: The schema id. + example: "abc" + eTag: + type: string + description: The eTag. + example: "33a64df551425fcc55e4d42a148795d9f25f89d4" + required: + - id +example: + general: + status: 412 + title: "Schema eTag Mismatch" + detail: "Schema with id 'abc' does not match the given etag '33a64df551425fcc55e4d42a148795d9f25f89d4'." + id: "abc" + eTag: "33a64df551425fcc55e4d42a148795d9f25f89d4" + type: "https://hivemq.com/edge/api/model/SchemaEtagMismatchError" diff --git a/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/SchemaInsufficientStorageError.yaml b/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/SchemaInsufficientStorageError.yaml new file mode 100644 index 0000000000..12e490c9c2 --- /dev/null +++ b/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/SchemaInsufficientStorageError.yaml @@ -0,0 +1,17 @@ +allOf: + - $ref: "../ApiProblemDetails.yaml" + - type: object + properties: + id: + type: string + description: The policy id. + example: "abc" + required: + - id +example: + general: + status: 507 + title: "Schema Insufficient Storage" + detail: "Schema with ID '123' could not be added because of insufficient server storage." + id: "abc" + type: "https://hivemq.com/edge/api/model/SchemaInsufficientStorageError" diff --git a/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/SchemaInvalidErrors.yaml b/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/SchemaInvalidErrors.yaml new file mode 100644 index 0000000000..aec67a1e3c --- /dev/null +++ b/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/SchemaInvalidErrors.yaml @@ -0,0 +1,25 @@ +allOf: + - $ref: "../ApiProblemDetails.yaml" + - type: object + properties: + childErrors: + type: array + description: List of child validation errors. + items: + $ref: "./SchemaValidationError.yaml" + required: + - childErrors +example: + general: + status: 400 + title: "Schema Invalid" + detail: "Schema is invalid due to validation errors." + type: "https://hivemq.com/edge/api/model/SchemaInvalidErrors" + childErrors: + - detail: "The length of script field '$.id' 1025 must be between 0 and 1024." + paths: "$.id" + value: "aaa...aaa" + actualLength: 1025 + expectedMinimumLength: 0 + expectedMaximumLength: 1024 + type: "https://hivemq.com/edge/api/model/InvalidFieldLengthValidationError" diff --git a/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/SchemaNotFoundError.yaml b/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/SchemaNotFoundError.yaml new file mode 100644 index 0000000000..fb7f559489 --- /dev/null +++ b/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/SchemaNotFoundError.yaml @@ -0,0 +1,17 @@ +allOf: + - $ref: "../ApiProblemDetails.yaml" + - type: object + properties: + id: + type: string + description: The schema ID. + example: "abc" + required: + - id +example: + general: + status: 404 + title: "Schema Not Found" + detail: "Schema with ID 'abc' is not found." + id: "abc" + type: "https://hivemq.com/edge/api/model/SchemaNotFoundError" diff --git a/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/SchemaParsingFailureError.yaml b/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/SchemaParsingFailureError.yaml new file mode 100644 index 0000000000..b732896c47 --- /dev/null +++ b/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/SchemaParsingFailureError.yaml @@ -0,0 +1,17 @@ +allOf: + - $ref: "../ApiProblemDetails.yaml" + - type: object + properties: + alias: + type: string + description: The schema alias. + example: "abc" + required: + - alias +example: + general: + status: 400 + title: "Schema Parsing Failure" + detail: "The given schema 'abc' could not be parsed." + alias: "abc" + type: "https://hivemq.com/edge/api/model/SchemaParsingFailureError" diff --git a/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/SchemaReferencedError.yaml b/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/SchemaReferencedError.yaml new file mode 100644 index 0000000000..c76cd6d91c --- /dev/null +++ b/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/SchemaReferencedError.yaml @@ -0,0 +1,17 @@ +allOf: + - $ref: "../ApiProblemDetails.yaml" + - type: object + properties: + id: + type: string + description: The schema ID. + example: "abc" + required: + - id +example: + general: + status: 400 + title: "Schema Referenced" + detail: "Schema with ID 'abc' is referenced." + id: "abc" + type: "https://hivemq.com/edge/api/model/SchemaReferencedError" diff --git a/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/SchemaValidationError.yaml b/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/SchemaValidationError.yaml new file mode 100644 index 0000000000..cd314c7c79 --- /dev/null +++ b/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/SchemaValidationError.yaml @@ -0,0 +1,18 @@ +allOf: + - $ref: "../validation/ValidationError.yaml" + - oneOf: + - $ref: "../validation/EmptyFieldValidationError.yaml" + - $ref: "../validation/InvalidFieldLengthValidationError.yaml" + - $ref: "../validation/InvalidFieldValueValidationError.yaml" + - $ref: "../validation/InvalidIdentifierValidationError.yaml" + - $ref: "../validation/MissingFieldValidationError.yaml" + - $ref: "../validation/UnsupportedFieldValidationError.yaml" +discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/EmptyFieldValidationError: "../validation/EmptyFieldValidationError.yaml" + https://hivemq.com/edge/api/model/InvalidFieldLengthValidationError: "../validation/InvalidFieldLengthValidationError.yaml" + https://hivemq.com/edge/api/model/InvalidFieldValueValidationError: "../validation/InvalidFieldValueValidationError.yaml" + https://hivemq.com/edge/api/model/InvalidIdentifierValidationError: "../validation/InvalidIdentifierValidationError.yaml" + https://hivemq.com/edge/api/model/MissingFieldValidationError: "../validation/MissingFieldValidationError.yaml" + https://hivemq.com/edge/api/model/UnsupportedFieldValidationError: "../validation/UnsupportedFieldValidationError.yaml" diff --git a/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/ScriptAlreadyPresentError.yaml b/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/ScriptAlreadyPresentError.yaml new file mode 100644 index 0000000000..3eaa052695 --- /dev/null +++ b/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/ScriptAlreadyPresentError.yaml @@ -0,0 +1,17 @@ +allOf: + - $ref: "../ApiProblemDetails.yaml" + - type: object + properties: + id: + type: string + description: The script id. + example: "abc" + required: + - id +example: + general: + status: 409 + title: "Script Already Present" + detail: "The given script 'abc' is already present." + id: "abc" + type: "https://hivemq.com/edge/api/model/ScriptAlreadyPresentError" diff --git a/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/ScriptCreationFailureError.yaml b/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/ScriptCreationFailureError.yaml new file mode 100644 index 0000000000..e87b021ba2 --- /dev/null +++ b/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/ScriptCreationFailureError.yaml @@ -0,0 +1,8 @@ +allOf: + - $ref: "../ApiProblemDetails.yaml" +example: + general: + status: 400 + title: "Script Creation Failure" + detail: "The given script could not be created." + type: "https://hivemq.com/edge/api/model/ScriptCreationFailureError" diff --git a/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/ScriptEtagMismatchError.yaml b/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/ScriptEtagMismatchError.yaml new file mode 100644 index 0000000000..cedf730d53 --- /dev/null +++ b/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/ScriptEtagMismatchError.yaml @@ -0,0 +1,22 @@ +allOf: + - $ref: "../ApiProblemDetails.yaml" + - type: object + properties: + id: + type: string + description: The script id. + example: "abc" + eTag: + type: string + description: The eTag. + example: "33a64df551425fcc55e4d42a148795d9f25f89d4" + required: + - id +example: + general: + status: 412 + title: "Script eTag Mismatch" + detail: "Script with id 'abc' does not match the given etag '33a64df551425fcc55e4d42a148795d9f25f89d4'." + id: "abc" + eTag: "33a64df551425fcc55e4d42a148795d9f25f89d4" + type: "https://hivemq.com/edge/api/model/ScriptEtagMismatchError" diff --git a/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/ScriptInsufficientStorageError.yaml b/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/ScriptInsufficientStorageError.yaml new file mode 100644 index 0000000000..718c032f3e --- /dev/null +++ b/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/ScriptInsufficientStorageError.yaml @@ -0,0 +1,17 @@ +allOf: + - $ref: "../ApiProblemDetails.yaml" + - type: object + properties: + id: + type: string + description: The policy id. + example: "abc" + required: + - id +example: + general: + status: 507 + title: "Script Insufficient Storage" + detail: "Script with ID '123' could not be added because of insufficient server storage." + id: "abc" + type: "https://hivemq.com/edge/api/model/ScriptInsufficientStorageError" diff --git a/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/ScriptInvalidErrors.yaml b/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/ScriptInvalidErrors.yaml new file mode 100644 index 0000000000..d2519e5ae1 --- /dev/null +++ b/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/ScriptInvalidErrors.yaml @@ -0,0 +1,25 @@ +allOf: + - $ref: "../ApiProblemDetails.yaml" + - type: object + properties: + childErrors: + type: array + description: List of child validation errors. + items: + $ref: "./ScriptValidationError.yaml" + required: + - childErrors +example: + general: + status: 400 + title: "Script Invalid" + detail: "Script is invalid due to validation errors." + type: "https://hivemq.com/edge/api/model/ScriptInvalidErrors" + childErrors: + - detail: "The length of script field '$.id' 1025 must be between 0 and 1024." + paths: "$.id" + value: "aaa...aaa" + actualLength: 1025 + expectedMinimumLength: 0 + expectedMaximumLength: 1024 + type: "https://hivemq.com/edge/api/model/InvalidFieldLengthValidationError" diff --git a/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/ScriptNotFoundError.yaml b/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/ScriptNotFoundError.yaml new file mode 100644 index 0000000000..d6d36a8eab --- /dev/null +++ b/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/ScriptNotFoundError.yaml @@ -0,0 +1,17 @@ +allOf: + - $ref: "../ApiProblemDetails.yaml" + - type: object + properties: + id: + type: string + description: The script ID. + example: "abc" + required: + - id +example: + general: + status: 404 + title: "Script Not Found" + detail: "Script with ID 'abc' is not found." + id: "abc" + type: "https://hivemq.com/edge/api/model/ScriptNotFoundError" diff --git a/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/ScriptParsingFailureError.yaml b/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/ScriptParsingFailureError.yaml new file mode 100644 index 0000000000..b2ddfde818 --- /dev/null +++ b/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/ScriptParsingFailureError.yaml @@ -0,0 +1,8 @@ +allOf: + - $ref: "../ApiProblemDetails.yaml" +example: + general: + status: 400 + title: "Script Parsing Failure" + detail: "The given script 'abc' could not be parsed." + type: "https://hivemq.com/edge/api/model/ScriptParsingFailureError" diff --git a/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/ScriptReferencedError.yaml b/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/ScriptReferencedError.yaml new file mode 100644 index 0000000000..a43a8e8691 --- /dev/null +++ b/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/ScriptReferencedError.yaml @@ -0,0 +1,17 @@ +allOf: + - $ref: "../ApiProblemDetails.yaml" + - type: object + properties: + id: + type: string + description: The script ID. + example: "abc" + required: + - id +example: + general: + status: 400 + title: "Script Referenced" + detail: "Script with ID 'abc' is referenced." + id: "abc" + type: "https://hivemq.com/edge/api/model/ScriptReferencedError" diff --git a/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/ScriptSanitationFailureError.yaml b/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/ScriptSanitationFailureError.yaml new file mode 100644 index 0000000000..47ff64b1a9 --- /dev/null +++ b/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/ScriptSanitationFailureError.yaml @@ -0,0 +1,8 @@ +allOf: + - $ref: "../ApiProblemDetails.yaml" +example: + general: + status: 400 + title: "Script Sanitation Failure" + detail: "The given script could not be sanitized." + type: "https://hivemq.com/edge/api/model/ScriptSanitationFailureError" diff --git a/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/ScriptValidationError.yaml b/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/ScriptValidationError.yaml new file mode 100644 index 0000000000..bf16f13445 --- /dev/null +++ b/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/ScriptValidationError.yaml @@ -0,0 +1,16 @@ +allOf: + - $ref: "../validation/ValidationError.yaml" + - oneOf: + - $ref: "../validation/InvalidFieldLengthValidationError.yaml" + - $ref: "../validation/InvalidFieldValueValidationError.yaml" + - $ref: "../validation/InvalidIdentifierValidationError.yaml" + - $ref: "../validation/MissingFieldValidationError.yaml" + - $ref: "../validation/UnsupportedFieldValidationError.yaml" +discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/InvalidFieldLengthValidationError: "../validation/InvalidFieldLengthValidationError.yaml" + https://hivemq.com/edge/api/model/InvalidFieldValueValidationError: "../validation/InvalidFieldValueValidationError.yaml" + https://hivemq.com/edge/api/model/InvalidIdentifierValidationError: "../validation/InvalidIdentifierValidationError.yaml" + https://hivemq.com/edge/api/model/MissingFieldValidationError: "../validation/MissingFieldValidationError.yaml" + https://hivemq.com/edge/api/model/UnsupportedFieldValidationError: "../validation/UnsupportedFieldValidationError.yaml" diff --git a/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/TopicFilterMismatchError.yaml b/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/TopicFilterMismatchError.yaml new file mode 100644 index 0000000000..f056a95efe --- /dev/null +++ b/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/TopicFilterMismatchError.yaml @@ -0,0 +1,16 @@ +allOf: + - $ref: "../ApiProblemDetails.yaml" + - type: object + properties: + path: + type: string + description: The json path of the topic filter. + example: "$.filter" + required: + - path +example: + general: + status: 400 + title: "Topic Filter Mismatch" + detail: "The topic filter '$.filter' mismatches." + type: "https://hivemq.com/edge/api/model/TopicFilterMismatchError" diff --git a/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/UnknownVariableValidationError.yaml b/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/UnknownVariableValidationError.yaml new file mode 100644 index 0000000000..fa6550e592 --- /dev/null +++ b/hivemq-edge-openapi/openapi/components/schemas/errors/datahub/UnknownVariableValidationError.yaml @@ -0,0 +1,29 @@ +allOf: + - $ref: "../validation/ValidationError.yaml" + - type: object + properties: + path: + type: string + description: The json path of the field. + example: "$.path" + variables: + type: array + items: + type: string + description: The unknown variables. + example: + - "a" + - "b" + - "c" + required: + - path + - variables +example: + general: + detail: "Field '$.path' contains unknown variables: [a, b, c]." + path: "$.path" + variables: + - "a" + - "b" + - "c" + type: "https://hivemq.com/edge/api/model/UnknownVariableValidationError" diff --git a/hivemq-edge-openapi/openapi/components/schemas/errors/http/InsufficientStorageError.yaml b/hivemq-edge-openapi/openapi/components/schemas/errors/http/InsufficientStorageError.yaml new file mode 100644 index 0000000000..ee12683fe0 --- /dev/null +++ b/hivemq-edge-openapi/openapi/components/schemas/errors/http/InsufficientStorageError.yaml @@ -0,0 +1,8 @@ +allOf: + - $ref: "../ApiProblemDetails.yaml" +example: + general: + status: 507 + title: "Insufficient Storage" + detail: "Insufficient Storage." + type: "https://hivemq.com/edge/api/model/InsufficientStorageError" diff --git a/hivemq-edge-openapi/openapi/components/schemas/errors/http/InternalServerError.yaml b/hivemq-edge-openapi/openapi/components/schemas/errors/http/InternalServerError.yaml new file mode 100644 index 0000000000..a43ce5dbb1 --- /dev/null +++ b/hivemq-edge-openapi/openapi/components/schemas/errors/http/InternalServerError.yaml @@ -0,0 +1,13 @@ +allOf: + - $ref: "../ApiProblemDetails.yaml" +example: + general: + status: 500 + title: "Internal Server Error" + detail: "An unexpected error occurred, check the logs." + type: "https://hivemq.com/edge/api/model/InternalServerError" + creation: + status: 500 + title: "Internal Server Error" + detail: "An unexpected error occurred: Exception during creation of the Json Schema for functions." + type: "https://hivemq.com/edge/api/model/InternalServerError" diff --git a/hivemq-edge-openapi/openapi/components/schemas/errors/http/InvalidQueryParameterError.yaml b/hivemq-edge-openapi/openapi/components/schemas/errors/http/InvalidQueryParameterError.yaml new file mode 100644 index 0000000000..1cf783a41c --- /dev/null +++ b/hivemq-edge-openapi/openapi/components/schemas/errors/http/InvalidQueryParameterError.yaml @@ -0,0 +1,16 @@ +allOf: + - $ref: "../ApiProblemDetails.yaml" + - type: object + properties: + parameter: + type: string + description: The query parameter. + required: + - parameter +example: + general: + status: 400 + title: "Query Parameter is Invalid" + detail: "Query parameter 'a' is invalid: 'a' could not be parsed." + parameter: "a" + type: "https://hivemq.com/edge/api/model/InvalidQueryParameterError" diff --git a/hivemq-edge-openapi/openapi/components/schemas/errors/http/PreconditionFailedError.yaml b/hivemq-edge-openapi/openapi/components/schemas/errors/http/PreconditionFailedError.yaml new file mode 100644 index 0000000000..bfe529d962 --- /dev/null +++ b/hivemq-edge-openapi/openapi/components/schemas/errors/http/PreconditionFailedError.yaml @@ -0,0 +1,8 @@ +allOf: + - $ref: "../ApiProblemDetails.yaml" +example: + general: + status: 412 + title: "Precondition Failed" + detail: "A precondition required for fulfilling the request was not fulfilled: Policy does not match the given etag 'abc'." + type: "https://hivemq.com/edge/api/model/PreconditionFailedError" diff --git a/hivemq-edge-openapi/openapi/components/schemas/errors/http/RequestBodyMissingError.yaml b/hivemq-edge-openapi/openapi/components/schemas/errors/http/RequestBodyMissingError.yaml new file mode 100644 index 0000000000..872361f40b --- /dev/null +++ b/hivemq-edge-openapi/openapi/components/schemas/errors/http/RequestBodyMissingError.yaml @@ -0,0 +1,8 @@ +allOf: + - $ref: "../ApiProblemDetails.yaml" +example: + general: + status: 400 + title: "Required Request Body Missing" + detail: "Required request body is missing." + type: "https://hivemq.com/edge/api/model/RequestBodyMissingError" diff --git a/hivemq-edge-openapi/openapi/components/schemas/errors/http/RequestBodyParameterMissingError.yaml b/hivemq-edge-openapi/openapi/components/schemas/errors/http/RequestBodyParameterMissingError.yaml new file mode 100644 index 0000000000..6459c06c76 --- /dev/null +++ b/hivemq-edge-openapi/openapi/components/schemas/errors/http/RequestBodyParameterMissingError.yaml @@ -0,0 +1,16 @@ +allOf: + - $ref: "../ApiProblemDetails.yaml" + - type: object + properties: + parameter: + type: string + description: The the missing request body parameter. + required: + - parameter +example: + general: + status: 400 + title: "Required Request Body Parameter Missing" + detail: "Required request body parameter 'a' is missing." + parameter: "a" + type: "https://hivemq.com/edge/api/model/RequestBodyParameterMissingError" diff --git a/hivemq-edge-openapi/openapi/components/schemas/errors/http/TemporaryNotAvailableError.yaml b/hivemq-edge-openapi/openapi/components/schemas/errors/http/TemporaryNotAvailableError.yaml new file mode 100644 index 0000000000..a4e9708441 --- /dev/null +++ b/hivemq-edge-openapi/openapi/components/schemas/errors/http/TemporaryNotAvailableError.yaml @@ -0,0 +1,8 @@ +allOf: + - $ref: "../ApiProblemDetails.yaml" +example: + general: + status: 503 + title: "Endpoint Temporarily not Available" + detail: "The endpoint is temporarily not available, please try again later." + type: "https://hivemq.com/edge/api/model/TemporaryNotAvailableError" diff --git a/hivemq-edge-openapi/openapi/components/schemas/errors/http/UrlParameterMissingError.yaml b/hivemq-edge-openapi/openapi/components/schemas/errors/http/UrlParameterMissingError.yaml new file mode 100644 index 0000000000..829998c05b --- /dev/null +++ b/hivemq-edge-openapi/openapi/components/schemas/errors/http/UrlParameterMissingError.yaml @@ -0,0 +1,16 @@ +allOf: + - $ref: "../ApiProblemDetails.yaml" + - type: object + properties: + parameter: + type: string + description: The name of the missing parameter. + required: + - parameter +example: + general: + status: 400 + title: "Required URL Parameter Missing" + detail: "Required URL parameter 'a' is missing." + parameter: "a" + type: "https://hivemq.com/edge/api/model/UrlParameterMissingError" diff --git a/hivemq-edge-openapi/openapi/components/schemas/errors/validation/AtLeastOneFieldMissingValidationError.yaml b/hivemq-edge-openapi/openapi/components/schemas/errors/validation/AtLeastOneFieldMissingValidationError.yaml new file mode 100644 index 0000000000..ff2f77a449 --- /dev/null +++ b/hivemq-edge-openapi/openapi/components/schemas/errors/validation/AtLeastOneFieldMissingValidationError.yaml @@ -0,0 +1,23 @@ +allOf: + - $ref: "./ValidationError.yaml" + - type: object + properties: + paths: + type: array + description: The missing json paths. + items: + type: string + format: json-path + description: The json path. + example: + - "$.field1" + - "$.field2" + required: + - paths +example: + general: + detail: "At least one of the fields must be present: '$.field1', '$.field2'." + paths: + - "$.field1" + - "$.field2" + type: "https://hivemq.com/edge/api/model/AtLeastOneFieldMissingValidationError" diff --git a/hivemq-edge-openapi/openapi/components/schemas/errors/validation/EmptyFieldValidationError.yaml b/hivemq-edge-openapi/openapi/components/schemas/errors/validation/EmptyFieldValidationError.yaml new file mode 100644 index 0000000000..021b4f1a64 --- /dev/null +++ b/hivemq-edge-openapi/openapi/components/schemas/errors/validation/EmptyFieldValidationError.yaml @@ -0,0 +1,16 @@ +allOf: + - $ref: "./ValidationError.yaml" + - type: object + properties: + path: + type: string + format: json-path + description: The missing field. + example: "$.field" + required: + - path +example: + general: + detail: "Required field '$.field' is empty." + path: "$.field" + type: "https://hivemq.com/edge/api/model/EmptyFieldValidationError" diff --git a/hivemq-edge-openapi/openapi/components/schemas/errors/validation/InvalidFieldLengthValidationError.yaml b/hivemq-edge-openapi/openapi/components/schemas/errors/validation/InvalidFieldLengthValidationError.yaml new file mode 100644 index 0000000000..4d7ac61029 --- /dev/null +++ b/hivemq-edge-openapi/openapi/components/schemas/errors/validation/InvalidFieldLengthValidationError.yaml @@ -0,0 +1,45 @@ +allOf: + - $ref: "./ValidationError.yaml" + - type: object + properties: + actualLength: + type: integer + format: int32 + description: The actual length of the field value. + example: 10 + expectedMinimumLength: + type: integer + format: int32 + description: The minimum length expected for the field value. + minimum: 0 + example: 5 + expectedMaximumLength: + type: integer + format: int32 + description: The maximum length expected for the field value. + minimum: 0 + example: 20 + path: + type: string + format: json-path + description: The invalid json path. + example: "$.field" + value: + type: string + description: The invalid value. + example: "function transform() { return 'Hello, World!'; }" + required: + - actualLength + - expectedMinimumLength + - expectedMaximumLength + - path + - value +example: + general: + detail: "The length of script field '$.transform' 48 must be between 0 and 20." + actualLength: 48 + minimumLength: 0 + maximumLength: 20 + path: "$.transform" + value: "function transform() { return 'Hello, World!'; }" + type: "https://hivemq.com/edge/api/model/InvalidFieldLengthValidationError" diff --git a/hivemq-edge-openapi/openapi/components/schemas/errors/validation/InvalidFieldValueValidationError.yaml b/hivemq-edge-openapi/openapi/components/schemas/errors/validation/InvalidFieldValueValidationError.yaml new file mode 100644 index 0000000000..6de8d87fb7 --- /dev/null +++ b/hivemq-edge-openapi/openapi/components/schemas/errors/validation/InvalidFieldValueValidationError.yaml @@ -0,0 +1,21 @@ +allOf: + - $ref: "./ValidationError.yaml" + - type: object + properties: + path: + type: string + format: json-path + description: The invalid json path. + example: "$.action.pipeline[1].field" + value: + type: string + description: The invalid value. + example: "functionDoesNotExist" + required: + - path +example: + general: + detail: "Referenced function does not exist." + path: "$.action.pipeline[1].field" + value: "functionDoesNotExist" + type: "https://hivemq.com/edge/api/model/InvalidFieldValueValidationError" diff --git a/hivemq-edge-openapi/openapi/components/schemas/errors/validation/InvalidIdentifierValidationError.yaml b/hivemq-edge-openapi/openapi/components/schemas/errors/validation/InvalidIdentifierValidationError.yaml new file mode 100644 index 0000000000..d9338bb200 --- /dev/null +++ b/hivemq-edge-openapi/openapi/components/schemas/errors/validation/InvalidIdentifierValidationError.yaml @@ -0,0 +1,22 @@ +allOf: + - $ref: "./ValidationError.yaml" + - type: object + properties: + path: + type: string + format: json-path + description: The invalid identifier path. + example: "$.id" + value: + type: string + description: The invalid identifier value. + example: "invalidId" + required: + - path + - value +example: + general: + detail: "Identifier script 'id' must begin with a letter and may only consist of lowercase letters, uppercase letters, numbers, periods, hyphens, and underscores." + path: "$.id" + value: "invalidId" + type: "https://hivemq.com/edge/api/model/InvalidIdentifierValidationError" diff --git a/hivemq-edge-openapi/openapi/components/schemas/errors/validation/MissingFieldValidationError.yaml b/hivemq-edge-openapi/openapi/components/schemas/errors/validation/MissingFieldValidationError.yaml new file mode 100644 index 0000000000..9c929ecb7f --- /dev/null +++ b/hivemq-edge-openapi/openapi/components/schemas/errors/validation/MissingFieldValidationError.yaml @@ -0,0 +1,16 @@ +allOf: + - $ref: "./ValidationError.yaml" + - type: object + properties: + path: + type: string + format: json-path + description: The missing path. + example: "$.id" + required: + - path +example: + general: + detail: "Required field '$.id' is missing." + path: "$.id" + type: "https://hivemq.com/edge/api/model/MissingFieldValidationError" diff --git a/hivemq-edge-openapi/openapi/components/schemas/errors/validation/UnsupportedFieldValidationError.yaml b/hivemq-edge-openapi/openapi/components/schemas/errors/validation/UnsupportedFieldValidationError.yaml new file mode 100644 index 0000000000..32276a7885 --- /dev/null +++ b/hivemq-edge-openapi/openapi/components/schemas/errors/validation/UnsupportedFieldValidationError.yaml @@ -0,0 +1,26 @@ +allOf: + - $ref: "./ValidationError.yaml" + - type: object + properties: + actualValue: + type: string + description: The actual value. + expectedValue: + type: string + description: The expected value. + path: + type: string + format: json-path + description: The json path. + example: "$.id" + required: + - actualValue + - expectedValue + - path +example: + general: + detail: "Unsupported type 'String' for field '$.id'. Expected type is 'Object'." + actualValue: "String" + expectedValue: "Object" + path: "$.id" + type: "https://hivemq.com/edge/api/model/UnsupportedFieldValidationError" diff --git a/hivemq-edge-openapi/openapi/components/schemas/errors/validation/ValidationError.yaml b/hivemq-edge-openapi/openapi/components/schemas/errors/validation/ValidationError.yaml new file mode 100644 index 0000000000..48d91902e8 --- /dev/null +++ b/hivemq-edge-openapi/openapi/components/schemas/errors/validation/ValidationError.yaml @@ -0,0 +1,29 @@ +type: object +properties: + detail: + type: string + description: Detailed contextual description of the validation error. + type: + type: string + format: uri + description: Type of the validation error. +required: + - detail + - type +discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/AtLeastOneFieldMissingValidationError: "./AtLeastOneFieldMissingValidationError.yaml" + https://hivemq.com/edge/api/model/AtMostOneFunctionValidationError: "../datahub/AtMostOneFunctionValidationError.yaml" + https://hivemq.com/edge/api/model/EmptyFieldValidationError: "./EmptyFieldValidationError.yaml" + https://hivemq.com/edge/api/model/FunctionMustBePairedValidationError: "../datahub/FunctionMustBePairedValidationError.yaml" + https://hivemq.com/edge/api/model/IllegalEventTransitionValidationError: "../datahub/IllegalEventTransitionValidationError.yaml" + https://hivemq.com/edge/api/model/IllegalFunctionValidationError: "../datahub/IllegalFunctionValidationError.yaml" + https://hivemq.com/edge/api/model/InvalidFieldLengthValidationError: "./InvalidFieldLengthValidationError.yaml" + https://hivemq.com/edge/api/model/InvalidFieldValueValidationError: "./InvalidFieldValueValidationError.yaml" + https://hivemq.com/edge/api/model/InvalidFunctionOrderValidationError: "../datahub/InvalidFunctionOrderValidationError.yaml" + https://hivemq.com/edge/api/model/InvalidIdentifierValidationError: "./InvalidIdentifierValidationError.yaml" + https://hivemq.com/edge/api/model/InvalidSchemaVersionValidationError: "../datahub/InvalidSchemaVersionValidationError.yaml" + https://hivemq.com/edge/api/model/MissingFieldValidationError: "./MissingFieldValidationError.yaml" + https://hivemq.com/edge/api/model/UnknownVariableValidationError: "../datahub/UnknownVariableValidationError.yaml" + https://hivemq.com/edge/api/model/UnsupportedFieldValidationError: "./UnsupportedFieldValidationError.yaml" diff --git a/hivemq-edge-openapi/openapi/openapi.yaml b/hivemq-edge-openapi/openapi/openapi.yaml index eb6f8b5700..96cf32c3d5 100644 --- a/hivemq-edge-openapi/openapi/openapi.yaml +++ b/hivemq-edge-openapi/openapi/openapi.yaml @@ -30,7 +30,7 @@ info: imported into popular API tooling (e.g. Postman) or can be used to generate client-code for multiple programming languages. title: HiveMQ Edge REST API - version: 2025.14-SNAPSHOT + version: 2025.15-SNAPSHOT x-logo: url: https://www.hivemq.com/img/svg/hivemq-bee.svg tags: diff --git a/hivemq-edge-openapi/openapi/paths/api_v1_data-hub_behavior-validation_policies.yaml b/hivemq-edge-openapi/openapi/paths/api_v1_data-hub_behavior-validation_policies.yaml index 0ca3ca0e99..64b77e9ac8 100644 --- a/hivemq-edge-openapi/openapi/paths/api_v1_data-hub_behavior-validation_policies.yaml +++ b/hivemq-edge-openapi/openapi/paths/api_v1_data-hub_behavior-validation_policies.yaml @@ -178,12 +178,23 @@ get: schema: $ref: ../components/schemas/BehaviorPolicyList.yaml description: Success + '400': + content: + application/problem+json: + schema: + oneOf: + - $ref: "../components/schemas/errors/http/InvalidQueryParameterError.yaml" + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/InvalidQueryParameterError: "../components/schemas/errors/http/InvalidQueryParameterError.yaml" + description: URL parameter missing '503': content: - application/json: + application/problem+json: schema: - $ref: ../components/schemas/ProblemDetails.yaml - description: Temporarily not available + $ref: "../components/schemas/errors/http/TemporaryNotAvailableError.yaml" + description: Request resource temporary unavailable summary: Get all policies tags: - Data Hub - Behavior Policies @@ -268,34 +279,45 @@ post: description: Success '400': content: - application/json: + application/problem+json: schema: - $ref: ../components/schemas/ProblemDetails.yaml + oneOf: + - $ref: "../components/schemas/errors/datahub/BehaviorPolicyCreationFailureError.yaml" + - $ref: "../components/schemas/errors/datahub/BehaviorPolicyInvalidErrors.yaml" + - $ref: "../components/schemas/errors/datahub/BehaviorPolicyRejectedError.yaml" + - $ref: "../components/schemas/errors/http/RequestBodyMissingError.yaml" + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/BehaviorPolicyCreationFailureError: "../components/schemas/errors/datahub/BehaviorPolicyCreationFailureError.yaml" + https://hivemq.com/edge/api/model/BehaviorPolicyInvalidErrors: "../components/schemas/errors/datahub/BehaviorPolicyInvalidErrors.yaml" + https://hivemq.com/edge/api/model/BehaviorPolicyRejectedError: "../components/schemas/errors/datahub/BehaviorPolicyRejectedError.yaml" + https://hivemq.com/edge/api/model/RequestBodyMissingError: "../components/schemas/errors/http/RequestBodyMissingError.yaml" description: Policy creation failed '409': content: - application/json: + application/problem+json: schema: - $ref: ../components/schemas/ProblemDetails.yaml - description: Already exists + $ref: "../components/schemas/errors/datahub/BehaviorPolicyAlreadyPresentError.yaml" + description: Behavior policy already present '500': content: - application/json: + application/problem+json: schema: - $ref: ../components/schemas/ProblemDetails.yaml - description: Internal error + $ref: "../components/schemas/errors/http/InternalServerError.yaml" + description: Internal server error '503': content: - application/json: + application/problem+json: schema: - $ref: ../components/schemas/ProblemDetails.yaml - description: Temporarily unavailable + $ref: "../components/schemas/errors/http/TemporaryNotAvailableError.yaml" + description: Request resource temporary unavailable '507': content: - application/json: + application/problem+json: schema: - $ref: ../components/schemas/ProblemDetails.yaml - description: Insufficient storage error + $ref: "../components/schemas/errors/datahub/PolicyInsufficientStorageError.yaml" + description: Insufficient storage summary: Create a new policy tags: - Data Hub - Behavior Policies diff --git a/hivemq-edge-openapi/openapi/paths/api_v1_data-hub_behavior-validation_policies_{policyId}.yaml b/hivemq-edge-openapi/openapi/paths/api_v1_data-hub_behavior-validation_policies_{policyId}.yaml index afd96ea8d4..55bcc7b8a4 100644 --- a/hivemq-edge-openapi/openapi/paths/api_v1_data-hub_behavior-validation_policies_{policyId}.yaml +++ b/hivemq-edge-openapi/openapi/paths/api_v1_data-hub_behavior-validation_policies_{policyId}.yaml @@ -23,34 +23,39 @@ delete: description: Success, no response body '400': content: - application/json: + application/problem+json: schema: - $ref: ../components/schemas/ProblemDetails.yaml + oneOf: + - $ref: "../components/schemas/errors/http/UrlParameterMissingError.yaml" + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/UrlParameterMissingError: "../components/schemas/errors/http/UrlParameterMissingError.yaml" description: URL parameter missing '404': content: - application/json: + application/problem+json: schema: - $ref: ../components/schemas/ProblemDetails.yaml - description: Policy not found + $ref: "../components/schemas/errors/datahub/PolicyNotFoundError.yaml" + description: Behavior policy not found '412': content: - application/json: + application/problem+json: schema: - $ref: ../components/schemas/ProblemDetails.yaml + $ref: "../components/schemas/errors/http/PreconditionFailedError.yaml" description: Precondition failed '500': content: - application/json: + application/problem+json: schema: - $ref: ../components/schemas/ProblemDetails.yaml - description: Internal error + $ref: "../components/schemas/errors/http/InternalServerError.yaml" + description: Internal server error '503': content: - application/json: + application/problem+json: schema: - $ref: ../components/schemas/ProblemDetails.yaml - description: Temporarily not available + $ref: "../components/schemas/errors/http/TemporaryNotAvailableError.yaml" + description: Request resource temporary unavailable summary: Delete a behavior policy tags: - Data Hub - Behavior Policies @@ -121,16 +126,33 @@ get: description: Success '400': content: - application/json: + application/problem+json: schema: - $ref: ../components/schemas/ProblemDetails.yaml - description: Invalid query parameter + oneOf: + - $ref: "../components/schemas/errors/http/UrlParameterMissingError.yaml" + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/UrlParameterMissingError: "../components/schemas/errors/http/UrlParameterMissingError.yaml" + description: Bad request '404': content: - application/json: + application/problem+json: schema: - $ref: ../components/schemas/ProblemDetails.yaml + $ref: "../components/schemas/errors/datahub/BehaviorPolicyNotFoundError.yaml" description: Policy not found + '500': + content: + application/problem+json: + schema: + $ref: "../components/schemas/errors/http/InternalServerError.yaml" + description: Internal server error + '503': + content: + application/problem+json: + schema: + $ref: "../components/schemas/errors/http/TemporaryNotAvailableError.yaml" + description: Request resource temporary unavailable summary: Get a policy tags: - Data Hub - Behavior Policies @@ -233,40 +255,55 @@ put: description: Success '400': content: - application/json: + application/problem+json: schema: - $ref: ../components/schemas/ProblemDetails.yaml - description: Policy creation failed + oneOf: + - $ref: "../components/schemas/errors/http/RequestBodyMissingError.yaml" + - $ref: "../components/schemas/errors/http/UrlParameterMissingError.yaml" + - $ref: "../components/schemas/errors/datahub/BehaviorPolicyCreationFailureError.yaml" + - $ref: "../components/schemas/errors/datahub/BehaviorPolicyInvalidErrors.yaml" + - $ref: "../components/schemas/errors/datahub/BehaviorPolicyUpdateFailureError.yaml" + - $ref: "../components/schemas/errors/datahub/PolicyIdMismatchError.yaml" + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/RequestBodyMissingError: "../components/schemas/errors/http/RequestBodyMissingError.yaml" + https://hivemq.com/edge/api/model/UrlParameterMissingError: "../components/schemas/errors/http/UrlParameterMissingError.yaml" + https://hivemq.com/edge/api/model/BehaviorPolicyCreationFailureError: "../components/schemas/errors/datahub/BehaviorPolicyCreationFailureError.yaml" + https://hivemq.com/edge/api/model/BehaviorPolicyInvalidErrors: "../components/schemas/errors/datahub/BehaviorPolicyInvalidErrors.yaml" + https://hivemq.com/edge/api/model/BehaviorPolicyUpdateFailureError: "../components/schemas/errors/datahub/BehaviorPolicyUpdateFailureError.yaml" + https://hivemq.com/edge/api/model/PolicyIdMismatchError: "../components/schemas/errors/datahub/PolicyIdMismatchError.yaml" + description: Behavior policy creation failed '404': content: - application/json: + application/problem+json: schema: - $ref: ../components/schemas/ProblemDetails.yaml - description: Policy not found + $ref: "../components/schemas/errors/datahub/BehaviorPolicyNotFoundError.yaml" + description: Data policy not found '412': content: - application/json: + application/problem+json: schema: - $ref: ../components/schemas/ProblemDetails.yaml + $ref: "../components/schemas/errors/http/PreconditionFailedError.yaml" description: Precondition failed '500': content: - application/json: + application/problem+json: schema: - $ref: ../components/schemas/ProblemDetails.yaml - description: Internal error + $ref: "../components/schemas/errors/http/InternalServerError.yaml" + description: Internal server error '503': content: - application/json: + application/problem+json: schema: - $ref: ../components/schemas/ProblemDetails.yaml - description: Temporarily unavailable + $ref: "../components/schemas/errors/http/TemporaryNotAvailableError.yaml" + description: Request resource temporary unavailable '507': content: - application/json: + application/problem+json: schema: - $ref: ../components/schemas/ProblemDetails.yaml - description: Insufficient storage error - summary: Update an existing policy + $ref: "../components/schemas/errors/datahub/PolicyInsufficientStorageError.yaml" + description: Insufficient storage + summary: Update an existing behavior policy tags: - Data Hub - Behavior Policies diff --git a/hivemq-edge-openapi/openapi/paths/api_v1_data-hub_behavior-validation_states_{clientId}.yaml b/hivemq-edge-openapi/openapi/paths/api_v1_data-hub_behavior-validation_states_{clientId}.yaml index 8b6f8439fd..1475e24f93 100644 --- a/hivemq-edge-openapi/openapi/paths/api_v1_data-hub_behavior-validation_states_{clientId}.yaml +++ b/hivemq-edge-openapi/openapi/paths/api_v1_data-hub_behavior-validation_states_{clientId}.yaml @@ -38,22 +38,34 @@ get: description: Success '400': content: - application/json: + application/problem+json: schema: - $ref: ../components/schemas/ProblemDetails.yaml + oneOf: + - $ref: "../components/schemas/errors/http/UrlParameterMissingError.yaml" + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/UrlParameterMissingError: "../components/schemas/errors/http/UrlParameterMissingError.yaml" description: URL parameter missing '404': content: - application/json: + application/problem+json: schema: - $ref: ../components/schemas/ProblemDetails.yaml - description: Client is disconnected + oneOf: + - $ref: "../components/schemas/errors/datahub/ClientDisconnectedError.yaml" + - $ref: "../components/schemas/errors/datahub/ClientNotFoundError.yaml" + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/ClientDisconnectedError: "../components/schemas/errors/datahub/ClientDisconnectedError.yaml" + https://hivemq.com/edge/api/model/ClientNotFoundError: "../components/schemas/errors/datahub/ClientNotFoundError.yaml" + description: Client error '500': content: - application/json: + application/problem+json: schema: - $ref: ../components/schemas/ProblemDetails.yaml - description: Internal Server error + $ref: "../components/schemas/errors/http/InternalServerError.yaml" + description: Internal server error summary: Get the state of a client tags: - Data Hub - State diff --git a/hivemq-edge-openapi/openapi/paths/api_v1_data-hub_data-validation_policies.yaml b/hivemq-edge-openapi/openapi/paths/api_v1_data-hub_data-validation_policies.yaml index 4e05623e21..6eeed06c24 100644 --- a/hivemq-edge-openapi/openapi/paths/api_v1_data-hub_data-validation_policies.yaml +++ b/hivemq-edge-openapi/openapi/paths/api_v1_data-hub_data-validation_policies.yaml @@ -285,27 +285,20 @@ get: description: Success '400': content: - application/json: + application/problem+json: schema: - $ref: ../components/schemas/ProblemDetails.yaml + oneOf: + - $ref: "../components/schemas/errors/http/InvalidQueryParameterError.yaml" + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/InvalidQueryParameterError: "../components/schemas/errors/http/InvalidQueryParameterError.yaml" description: URL parameter missing - '404': - content: - application/json: - schema: - $ref: ../components/schemas/ProblemDetails.yaml - description: DataPolicy not found - '500': - content: - application/json: - schema: - $ref: ../components/schemas/ProblemDetails.yaml - description: Internal server error '503': content: - application/json: + application/problem+json: schema: - $ref: ../components/schemas/ProblemDetails.yaml + $ref: "../components/schemas/errors/http/TemporaryNotAvailableError.yaml" description: Request resource temporary unavailable summary: Get all data policies tags: @@ -397,33 +390,44 @@ post: description: Success '400': content: - application/json: + application/problem+json: schema: - $ref: ../components/schemas/ProblemDetails.yaml - description: DataPolicy creation failed + oneOf: + - $ref: "../components/schemas/errors/http/RequestBodyMissingError.yaml" + - $ref: "../components/schemas/errors/datahub/DataPolicyCreationFailureError.yaml" + - $ref: "../components/schemas/errors/datahub/DataPolicyInvalidErrors.yaml" + - $ref: "../components/schemas/errors/datahub/DataPolicyRejectedError.yaml" + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/RequestBodyMissingError: "../components/schemas/errors/http/RequestBodyMissingError.yaml" + https://hivemq.com/edge/api/model/DataPolicyCreationFailureError: "../components/schemas/errors/datahub/DataPolicyCreationFailureError.yaml" + https://hivemq.com/edge/api/model/DataPolicyInvalidErrors: "../components/schemas/errors/datahub/DataPolicyInvalidErrors.yaml" + https://hivemq.com/edge/api/model/DataPolicyRejectedError: "../components/schemas/errors/datahub/DataPolicyRejectedError.yaml" + description: Data policy creation failed '409': content: - application/json: + application/problem+json: schema: - $ref: ../components/schemas/ProblemDetails.yaml - description: DataPolicy already present + $ref: "../components/schemas/errors/datahub/DataPolicyAlreadyPresentError.yaml" + description: Data policy already present '500': content: - application/json: + application/problem+json: schema: - $ref: ../components/schemas/ProblemDetails.yaml + $ref: "../components/schemas/errors/http/InternalServerError.yaml" description: Internal server error '503': content: - application/json: + application/problem+json: schema: - $ref: ../components/schemas/ProblemDetails.yaml + $ref: "../components/schemas/errors/http/TemporaryNotAvailableError.yaml" description: Request resource temporary unavailable '507': content: - application/json: + application/problem+json: schema: - $ref: ../components/schemas/ProblemDetails.yaml + $ref: "../components/schemas/errors/datahub/PolicyInsufficientStorageError.yaml" description: Insufficient storage summary: Create a new data policy tags: diff --git a/hivemq-edge-openapi/openapi/paths/api_v1_data-hub_data-validation_policies_{policyId}.yaml b/hivemq-edge-openapi/openapi/paths/api_v1_data-hub_data-validation_policies_{policyId}.yaml index 9b83209505..fa19ca4cc5 100644 --- a/hivemq-edge-openapi/openapi/paths/api_v1_data-hub_data-validation_policies_{policyId}.yaml +++ b/hivemq-edge-openapi/openapi/paths/api_v1_data-hub_data-validation_policies_{policyId}.yaml @@ -23,27 +23,38 @@ delete: description: Success, no response body '400': content: - application/json: + application/problem+json: schema: - $ref: ../components/schemas/ProblemDetails.yaml + oneOf: + - $ref: "../components/schemas/errors/http/UrlParameterMissingError.yaml" + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/UrlParameterMissingError: "../components/schemas/errors/http/UrlParameterMissingError.yaml" description: URL parameter missing '404': content: - application/json: + application/problem+json: + schema: + $ref: "../components/schemas/errors/datahub/PolicyNotFoundError.yaml" + description: Data policy not found + '412': + content: + application/problem+json: schema: - $ref: ../components/schemas/ProblemDetails.yaml - description: DataPolicy not found + $ref: "../components/schemas/errors/http/PreconditionFailedError.yaml" + description: Precondition failed '500': content: - application/json: + application/problem+json: schema: - $ref: ../components/schemas/ProblemDetails.yaml + $ref: "../components/schemas/errors/http/InternalServerError.yaml" description: Internal server error '503': content: - application/json: + application/problem+json: schema: - $ref: ../components/schemas/ProblemDetails.yaml + $ref: "../components/schemas/errors/http/TemporaryNotAvailableError.yaml" description: Request resource temporary unavailable summary: Delete a data policy tags: @@ -118,32 +129,33 @@ get: description: Success '400': content: - application/json: - examples: - param-missing: - description: Example response when a required parameter is missing. - summary: Required URL parameter missing - value: - errors: - - title: Required parameter missing - detail: Required URL parameter 'parameterName' is missing + application/problem+json: schema: - $ref: ../components/schemas/ProblemDetails.yaml + oneOf: + - $ref: "../components/schemas/errors/http/UrlParameterMissingError.yaml" + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/UrlParameterMissingError: "../components/schemas/errors/http/UrlParameterMissingError.yaml" description: Bad request '404': content: - application/json: - examples: - not-found: - description: Policy not found - summary: Not found - value: - errors: - - title: Resource not found - detail: Resource with id 'my-resource-id' not found + application/problem+json: schema: - $ref: ../components/schemas/ProblemDetails.yaml + $ref: "../components/schemas/errors/datahub/PolicyNotFoundError.yaml" description: Resource not found + '500': + content: + application/problem+json: + schema: + $ref: "../components/schemas/errors/http/InternalServerError.yaml" + description: Internal server error + '503': + content: + application/problem+json: + schema: + $ref: "../components/schemas/errors/http/TemporaryNotAvailableError.yaml" + description: Request resource temporary unavailable summary: Get a data policy tags: - Data Hub - Data Policies @@ -253,33 +265,56 @@ put: description: Success '400': content: - application/json: + application/problem+json: schema: - $ref: ../components/schemas/ProblemDetails.yaml - description: DataPolicy creation failed + oneOf: + - $ref: "../components/schemas/errors/http/RequestBodyMissingError.yaml" + - $ref: "../components/schemas/errors/http/UrlParameterMissingError.yaml" + - $ref: "../components/schemas/errors/datahub/DataPolicyCreationFailureError.yaml" + - $ref: "../components/schemas/errors/datahub/DataPolicyInvalidErrors.yaml" + - $ref: "../components/schemas/errors/datahub/DataPolicyUpdateFailureError.yaml" + - $ref: "../components/schemas/errors/datahub/PolicyIdMismatchError.yaml" + - $ref: "../components/schemas/errors/datahub/TopicFilterMismatchError.yaml" + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/RequestBodyMissingError: "../components/schemas/errors/http/RequestBodyMissingError.yaml" + https://hivemq.com/edge/api/model/UrlParameterMissingError: "../components/schemas/errors/http/UrlParameterMissingError.yaml" + https://hivemq.com/edge/api/model/DataPolicyCreationFailureError: "../components/schemas/errors/datahub/DataPolicyCreationFailureError.yaml" + https://hivemq.com/edge/api/model/DataPolicyInvalidErrors: "../components/schemas/errors/datahub/DataPolicyInvalidErrors.yaml" + https://hivemq.com/edge/api/model/DataPolicyUpdateFailureError: "../components/schemas/errors/datahub/DataPolicyUpdateFailureError.yaml" + https://hivemq.com/edge/api/model/PolicyIdMismatchError: "../components/schemas/errors/datahub/PolicyIdMismatchError.yaml" + https://hivemq.com/edge/api/model/TopicFilterMismatchError: "../components/schemas/errors/datahub/TopicFilterMismatchError.yaml" + description: Data policy creation failed '404': content: - application/json: + application/problem+json: + schema: + $ref: "../components/schemas/errors/datahub/DataPolicyNotFoundError.yaml" + description: Data policy not found + '412': + content: + application/problem+json: schema: - $ref: ../components/schemas/ProblemDetails.yaml - description: DataPolicy not found + $ref: "../components/schemas/errors/http/PreconditionFailedError.yaml" + description: Precondition failed '500': content: - application/json: + application/problem+json: schema: - $ref: ../components/schemas/ProblemDetails.yaml + $ref: "../components/schemas/errors/http/InternalServerError.yaml" description: Internal server error '503': content: - application/json: + application/problem+json: schema: - $ref: ../components/schemas/ProblemDetails.yaml + $ref: "../components/schemas/errors/http/TemporaryNotAvailableError.yaml" description: Request resource temporary unavailable '507': content: - application/json: + application/problem+json: schema: - $ref: ../components/schemas/ProblemDetails.yaml + $ref: "../components/schemas/errors/datahub/PolicyInsufficientStorageError.yaml" description: Insufficient storage summary: Update an existing data policy tags: diff --git a/hivemq-edge-openapi/openapi/paths/api_v1_data-hub_fsm.yaml b/hivemq-edge-openapi/openapi/paths/api_v1_data-hub_fsm.yaml index a7b849a4bc..5f2c3de41d 100644 --- a/hivemq-edge-openapi/openapi/paths/api_v1_data-hub_fsm.yaml +++ b/hivemq-edge-openapi/openapi/paths/api_v1_data-hub_fsm.yaml @@ -90,9 +90,9 @@ get: description: Success '500': content: - application/json: + application/problem+json: schema: - $ref: ../components/schemas/Errors.yaml + $ref: "../components/schemas/errors/http/InternalServerError.yaml" description: Internal server error summary: Get all FSMs as a JSON Schema tags: diff --git a/hivemq-edge-openapi/openapi/paths/api_v1_data-hub_function-specs.yaml b/hivemq-edge-openapi/openapi/paths/api_v1_data-hub_function-specs.yaml index b19bb869ec..dfefb62682 100644 --- a/hivemq-edge-openapi/openapi/paths/api_v1_data-hub_function-specs.yaml +++ b/hivemq-edge-openapi/openapi/paths/api_v1_data-hub_function-specs.yaml @@ -12,9 +12,9 @@ get: description: Success '500': content: - application/json: + application/problem+json: schema: - $ref: ../components/schemas/ProblemDetails.yaml + $ref: "../components/schemas/errors/http/InternalServerError.yaml" description: Internal server error summary: Get all functions as a list of function specifications tags: diff --git a/hivemq-edge-openapi/openapi/paths/api_v1_data-hub_functions.yaml b/hivemq-edge-openapi/openapi/paths/api_v1_data-hub_functions.yaml index 6f4181e864..a7037eae9c 100644 --- a/hivemq-edge-openapi/openapi/paths/api_v1_data-hub_functions.yaml +++ b/hivemq-edge-openapi/openapi/paths/api_v1_data-hub_functions.yaml @@ -185,9 +185,9 @@ get: description: Success '500': content: - application/json: + application/problem+json: schema: - $ref: ../components/schemas/ProblemDetails.yaml + $ref: "../components/schemas/errors/http/InternalServerError.yaml" description: Internal server error summary: Get all functions as a JSON Schema tags: diff --git a/hivemq-edge-openapi/openapi/paths/api_v1_data-hub_interpolation-variables.yaml b/hivemq-edge-openapi/openapi/paths/api_v1_data-hub_interpolation-variables.yaml index 05b184908f..fb42b5f4b0 100644 --- a/hivemq-edge-openapi/openapi/paths/api_v1_data-hub_interpolation-variables.yaml +++ b/hivemq-edge-openapi/openapi/paths/api_v1_data-hub_interpolation-variables.yaml @@ -10,9 +10,9 @@ get: description: Success '500': content: - application/json: + application/problem+json: schema: - $ref: ../components/schemas/ProblemDetails.yaml + $ref: "../components/schemas/errors/http/InternalServerError.yaml" description: Internal server error summary: Get all interpolation variables tags: diff --git a/hivemq-edge-openapi/openapi/paths/api_v1_data-hub_schemas.yaml b/hivemq-edge-openapi/openapi/paths/api_v1_data-hub_schemas.yaml index 557fe41de4..46a39cfb96 100644 --- a/hivemq-edge-openapi/openapi/paths/api_v1_data-hub_schemas.yaml +++ b/hivemq-edge-openapi/openapi/paths/api_v1_data-hub_schemas.yaml @@ -151,11 +151,22 @@ get: schema: $ref: ../components/schemas/SchemaList.yaml description: Success + '400': + content: + application/problem+json: + schema: + oneOf: + - $ref: "../components/schemas/errors/http/InvalidQueryParameterError.yaml" + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/InvalidQueryParameterError: "../components/schemas/errors/http/InvalidQueryParameterError.yaml" + description: URL parameter missing '503': content: - application/json: + application/problem+json: schema: - $ref: ../components/schemas/ProblemDetails.yaml + $ref: "../components/schemas/errors/http/TemporaryNotAvailableError.yaml" description: Request resource temporary unavailable summary: Get all schemas tags: @@ -204,33 +215,48 @@ post: description: Success '400': content: - application/json: + application/problem+json: schema: - $ref: ../components/schemas/ProblemDetails.yaml - description: Schema could not be validatetd + oneOf: + - $ref: "../components/schemas/errors/http/RequestBodyParameterMissingError.yaml" + - $ref: "../components/schemas/errors/datahub/SchemaInvalidErrors.yaml" + - $ref: "../components/schemas/errors/datahub/SchemaParsingFailureError.yaml" + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/RequestBodyParameterMissingError: "../components/schemas/errors/http/RequestBodyParameterMissingError.yaml" + https://hivemq.com/edge/api/model/SchemaInvalidErrors: "../components/schemas/errors/datahub/SchemaInvalidErrors.yaml" + https://hivemq.com/edge/api/model/SchemaParsingFailureError: "../components/schemas/errors/datahub/SchemaParsingFailureError.yaml" + description: Schema creation failed '409': content: - application/json: + application/problem+json: schema: - $ref: ../components/schemas/ProblemDetails.yaml - description: Schema already exists + $ref: "../components/schemas/errors/datahub/SchemaAlreadyPresentError.yaml" + description: Schema is already present '412': content: - application/json: + application/problem+json: schema: - $ref: ../components/schemas/ProblemDetails.yaml - description: Mismatch between schema and etag + $ref: "../components/schemas/errors/datahub/SchemaEtagMismatchError.yaml" + description: Schema doesn't match etag '500': content: - application/json: + application/problem+json: schema: - $ref: ../components/schemas/ProblemDetails.yaml + $ref: "../components/schemas/errors/http/InternalServerError.yaml" description: Internal server error + '503': + content: + application/problem+json: + schema: + $ref: "../components/schemas/errors/http/TemporaryNotAvailableError.yaml" + description: Request resource temporary unavailable '507': content: - application/json: + application/problem+json: schema: - $ref: ../components/schemas/ProblemDetails.yaml + $ref: "../components/schemas/errors/datahub/SchemaInsufficientStorageError.yaml" description: Insufficient storage summary: Create a new schema tags: diff --git a/hivemq-edge-openapi/openapi/paths/api_v1_data-hub_schemas_{schemaId}.yaml b/hivemq-edge-openapi/openapi/paths/api_v1_data-hub_schemas_{schemaId}.yaml index 7a3a82ec52..40b6529113 100644 --- a/hivemq-edge-openapi/openapi/paths/api_v1_data-hub_schemas_{schemaId}.yaml +++ b/hivemq-edge-openapi/openapi/paths/api_v1_data-hub_schemas_{schemaId}.yaml @@ -23,33 +23,40 @@ delete: description: Success, no response body '400': content: - application/json: + application/problem+json: schema: - $ref: ../components/schemas/ProblemDetails.yaml - description: Schema referenced + oneOf: + - $ref: "../components/schemas/errors/http/UrlParameterMissingError.yaml" + - $ref: "../components/schemas/errors/datahub/SchemaReferencedError.yaml" + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/UrlParameterMissingError: "../components/schemas/errors/http/UrlParameterMissingError.yaml" + https://hivemq.com/edge/api/model/SchemaReferencedError: "../components/schemas/errors/datahub/SchemaReferencedError.yaml" + description: URL parameter missing '404': content: - application/json: + application/problem+json: schema: - $ref: ../components/schemas/ProblemDetails.yaml + $ref: "../components/schemas/errors/datahub/SchemaNotFoundError.yaml" description: Schema not found '412': content: - application/json: + application/problem+json: schema: - $ref: ../components/schemas/ProblemDetails.yaml - description: Mismatch between schema and etag + $ref: "../components/schemas/errors/datahub/SchemaEtagMismatchError.yaml" + description: Schema doesn't match etag '500': content: - application/json: + application/problem+json: schema: - $ref: ../components/schemas/ProblemDetails.yaml - description: Internal server error + $ref: "../components/schemas/errors/http/InternalServerError.yaml" + description: Internal Server error '503': content: - application/json: + application/problem+json: schema: - $ref: ../components/schemas/ProblemDetails.yaml + $ref: "../components/schemas/errors/http/TemporaryNotAvailableError.yaml" description: Request resource temporary unavailable summary: Delete all versions of the schema tags: @@ -98,22 +105,33 @@ get: description: Success '400': content: - application/json: + application/problem+json: schema: - $ref: ../components/schemas/ProblemDetails.yaml - description: A url parameter is missing + oneOf: + - $ref: "../components/schemas/errors/http/UrlParameterMissingError.yaml" + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/UrlParameterMissingError: "../components/schemas/errors/http/UrlParameterMissingError.yaml" + description: URL parameter missing '404': content: - application/json: + application/problem+json: schema: - $ref: ../components/schemas/ProblemDetails.yaml + $ref: "../components/schemas/errors/datahub/SchemaNotFoundError.yaml" description: Schema not found '500': content: - application/json: + application/problem+json: schema: - $ref: ../components/schemas/ProblemDetails.yaml + $ref: "../components/schemas/errors/http/InternalServerError.yaml" description: Internal server error + '503': + content: + application/problem+json: + schema: + $ref: "../components/schemas/errors/http/TemporaryNotAvailableError.yaml" + description: Request resource temporary unavailable summary: Get a schema tags: - Data Hub - Schemas diff --git a/hivemq-edge-openapi/openapi/paths/api_v1_data-hub_scripts.yaml b/hivemq-edge-openapi/openapi/paths/api_v1_data-hub_scripts.yaml index ec5233fc39..6c85cefa65 100644 --- a/hivemq-edge-openapi/openapi/paths/api_v1_data-hub_scripts.yaml +++ b/hivemq-edge-openapi/openapi/paths/api_v1_data-hub_scripts.yaml @@ -138,12 +138,23 @@ get: schema: $ref: ../components/schemas/ScriptList.yaml description: Success + '400': + content: + application/problem+json: + schema: + oneOf: + - $ref: "../components/schemas/errors/http/InvalidQueryParameterError.yaml" + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/InvalidQueryParameterError: "../components/schemas/errors/http/InvalidQueryParameterError.yaml" + description: URL parameter missing '503': content: - application/json: + application/problem+json: schema: - $ref: ../components/schemas/ProblemDetails.yaml - description: Temporary not available + $ref: "../components/schemas/errors/http/TemporaryNotAvailableError.yaml" + description: Request resource temporary unavailable summary: Get all scripts tags: - Data Hub - Scripts @@ -191,39 +202,52 @@ post: description: Success '400': content: - application/json: + application/problem+json: schema: - $ref: ../components/schemas/ProblemDetails.yaml - description: Script is invalid + oneOf: + - $ref: "../components/schemas/errors/http/RequestBodyParameterMissingError.yaml" + - $ref: "../components/schemas/errors/datahub/ScriptCreationFailureError.yaml" + - $ref: "../components/schemas/errors/datahub/ScriptInvalidErrors.yaml" + - $ref: "../components/schemas/errors/datahub/ScriptParsingFailureError.yaml" + - $ref: "../components/schemas/errors/datahub/ScriptSanitationFailureError.yaml" + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/RequestBodyParameterMissingError: "../components/schemas/errors/http/RequestBodyParameterMissingError.yaml" + https://hivemq.com/edge/api/model/ScriptCreationFailureError: "../components/schemas/errors/datahub/ScriptCreationFailureError.yaml" + https://hivemq.com/edge/api/model/ScriptInvalidErrors: "../components/schemas/errors/datahub/ScriptInvalidErrors.yaml" + https://hivemq.com/edge/api/model/ScriptParsingFailureError: "../components/schemas/errors/datahub/ScriptParsingFailureError.yaml" + https://hivemq.com/edge/api/model/ScriptSanitationFailureError: "../components/schemas/errors/datahub/ScriptSanitationFailureError.yaml" + description: Script creation failed '409': content: - application/json: + application/problem+json: schema: - $ref: ../components/schemas/ProblemDetails.yaml + $ref: "../components/schemas/errors/datahub/ScriptAlreadyPresentError.yaml" description: Script is already present '412': content: - application/json: + application/problem+json: schema: - $ref: ../components/schemas/ProblemDetails.yaml + $ref: "../components/schemas/errors/datahub/ScriptEtagMismatchError.yaml" description: Script doesn't match etag '500': content: - application/json: + application/problem+json: schema: - $ref: ../components/schemas/ProblemDetails.yaml + $ref: "../components/schemas/errors/http/InternalServerError.yaml" description: Internal server error '503': content: - application/json: + application/problem+json: schema: - $ref: ../components/schemas/ProblemDetails.yaml - description: Temporary not available + $ref: "../components/schemas/errors/http/TemporaryNotAvailableError.yaml" + description: Request resource temporary unavailable '507': content: - application/json: + application/problem+json: schema: - $ref: ../components/schemas/ProblemDetails.yaml + $ref: "../components/schemas/errors/datahub/ScriptInsufficientStorageError.yaml" description: Insufficient storage summary: Create a new script tags: diff --git a/hivemq-edge-openapi/openapi/paths/api_v1_data-hub_scripts_{scriptId}.yaml b/hivemq-edge-openapi/openapi/paths/api_v1_data-hub_scripts_{scriptId}.yaml index 8e1f08c279..d1e9ef1785 100644 --- a/hivemq-edge-openapi/openapi/paths/api_v1_data-hub_scripts_{scriptId}.yaml +++ b/hivemq-edge-openapi/openapi/paths/api_v1_data-hub_scripts_{scriptId}.yaml @@ -20,34 +20,41 @@ delete: description: Success, no response body '400': content: - application/json: + application/problem+json: schema: - $ref: ../components/schemas/ProblemDetails.yaml - description: Script is referenced + oneOf: + - $ref: "../components/schemas/errors/http/UrlParameterMissingError.yaml" + - $ref: "../components/schemas/errors/datahub/ScriptReferencedError.yaml" + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/UrlParameterMissingError: "../components/schemas/errors/http/UrlParameterMissingError.yaml" + https://hivemq.com/edge/api/model/ScriptReferencedError: "../components/schemas/errors/datahub/ScriptReferencedError.yaml" + description: URL parameter missing '404': content: - application/json: + application/problem+json: schema: - $ref: ../components/schemas/ProblemDetails.yaml + $ref: "../components/schemas/errors/datahub/ScriptNotFoundError.yaml" description: Script not found '412': content: - application/json: + application/problem+json: schema: - $ref: ../components/schemas/ProblemDetails.yaml + $ref: "../components/schemas/errors/datahub/ScriptEtagMismatchError.yaml" description: Script doesn't match etag '500': content: - application/json: + application/problem+json: schema: - $ref: ../components/schemas/ProblemDetails.yaml + $ref: "../components/schemas/errors/http/InternalServerError.yaml" description: Internal Server error '503': content: - application/json: + application/problem+json: schema: - $ref: ../components/schemas/ProblemDetails.yaml - description: Temporary not available + $ref: "../components/schemas/errors/http/TemporaryNotAvailableError.yaml" + description: Request resource temporary unavailable summary: Delete a script tags: - Data Hub - Scripts @@ -91,28 +98,33 @@ get: description: Success '400': content: - application/json: + application/problem+json: schema: - $ref: ../components/schemas/ProblemDetails.yaml + oneOf: + - $ref: "../components/schemas/errors/http/UrlParameterMissingError.yaml" + discriminator: + propertyName: type + mapping: + https://hivemq.com/edge/api/model/UrlParameterMissingError: "../components/schemas/errors/http/UrlParameterMissingError.yaml" description: URL parameter missing '404': content: - application/json: + application/problem+json: schema: - $ref: ../components/schemas/ProblemDetails.yaml + $ref: "../components/schemas/errors/datahub/ScriptNotFoundError.yaml" description: Script not found '500': content: - application/json: + application/problem+json: schema: - $ref: ../components/schemas/ProblemDetails.yaml + $ref: "../components/schemas/errors/http/InternalServerError.yaml" description: Internal Server error '503': content: - application/json: + application/problem+json: schema: - $ref: ../components/schemas/ProblemDetails.yaml - description: Temporary not available + $ref: "../components/schemas/errors/http/TemporaryNotAvailableError.yaml" + description: Request resource temporary unavailable summary: Get a script tags: - Data Hub - Scripts diff --git a/hivemq-edge-openapi/openapi/templates/Java/README.md b/hivemq-edge-openapi/openapi/templates/Java/README.md new file mode 100644 index 0000000000..2b408e9b31 --- /dev/null +++ b/hivemq-edge-openapi/openapi/templates/Java/README.md @@ -0,0 +1,29 @@ +# OpenAPI Templates - Java + +This folder is for overwriting the default OpenAPI Java templates. + +## Where to Download the Templates? + +```bash +git clone https://github.com/OpenAPITools/openapi-generator.git +``` + +## Change Logs + +Last updated: 2025-07-01 + +### `typeInfoAnnotation.mustache` + +The discriminator name `type` conflicts with the JackSon `type`. This patch changes the JackSon `type` to `jsontype`. + +```diff +@JsonIgnoreProperties( +- value = "{{{discriminator.propertyBaseName}}}", // ignore manually set {{{discriminator.propertyBaseName}}}, it will be automatically generated by Jackson during serialization +- allowSetters = true // allows the {{{discriminator.propertyBaseName}}} to be set during deserialization + value = "json{{{discriminator.propertyBaseName}}}", // ignore manually set json{{{discriminator.propertyBaseName}}}, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the json{{{discriminator.propertyBaseName}}} to be set during deserialization +) + +- @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "{{{discriminator.propertyBaseName}}}", visible = true) ++ @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "json{{{discriminator.propertyBaseName}}}", visible = true) +``` diff --git a/hivemq-edge-openapi/openapi/templates/Java/typeInfoAnnotation.mustache b/hivemq-edge-openapi/openapi/templates/Java/typeInfoAnnotation.mustache new file mode 100644 index 0000000000..76594d1956 --- /dev/null +++ b/hivemq-edge-openapi/openapi/templates/Java/typeInfoAnnotation.mustache @@ -0,0 +1,24 @@ +{{#jackson}} + +@JsonIgnoreProperties( + value = "json{{{discriminator.propertyBaseName}}}", // ignore manually set json{{{discriminator.propertyBaseName}}}, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the json{{{discriminator.propertyBaseName}}} to be set during deserialization +) + +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "json{{{discriminator.propertyBaseName}}}", visible = true) +{{#discriminator.mappedModels}} +{{#-first}} +@JsonSubTypes({ +{{/-first}} + @JsonSubTypes.Type(value = {{modelName}}.class, name = "{{^vendorExtensions.x-discriminator-value}}{{mappingName}}{{/vendorExtensions.x-discriminator-value}}{{#vendorExtensions.x-discriminator-value}}{{{vendorExtensions.x-discriminator-value}}}{{/vendorExtensions.x-discriminator-value}}"), +{{#-last}} +}) +{{/-last}} +{{/discriminator.mappedModels}} +{{/jackson}} +{{#jsonbPolymorphism}} +@JsonbTypeInfo(key = "{{{discriminator.propertyBaseName}}}"{{#discriminator.mappedModels}}{{#-first}}, value = { +{{/-first}} + @JsonbSubtype(alias = "{{^vendorExtensions.x-discriminator-value}}{{mappingName}}{{/vendorExtensions.x-discriminator-value}}{{#vendorExtensions.x-discriminator-value}}{{{vendorExtensions.x-discriminator-value}}}{{/vendorExtensions.x-discriminator-value}}", type = {{modelName}}.class), +{{#-last}} +}{{/-last}}{{/discriminator.mappedModels}}){{/jsonbPolymorphism}} \ No newline at end of file diff --git a/hivemq-edge/build.gradle.kts b/hivemq-edge/build.gradle.kts index 445eff1fe1..36cb926574 100644 --- a/hivemq-edge/build.gradle.kts +++ b/hivemq-edge/build.gradle.kts @@ -197,6 +197,9 @@ dependencies { // json path implementation(libs.json.path) + // i18n + implementation(libs.freemarker) + // Edge modules compileOnly("com.hivemq:hivemq-edge-module-etherip") compileOnly("com.hivemq:hivemq-edge-module-plc4x") @@ -279,6 +282,7 @@ val buildDirectory = layout.buildDirectory.get() tasks.register("genJaxRs") { inputSpec.set("${projectDir}/../ext/hivemq-edge-openapi-${project.version}.yaml") outputDir.set("${buildDirectory}/generated/openapi") + templateDir.set("$projectDir/../hivemq-edge-openapi/openapi/templates/Java") generatorName.set("jaxrs-spec") apiPackage.set("com.hivemq.edge.api") modelPackage.set("com.hivemq.edge.api.model") @@ -418,6 +422,7 @@ license { header = file("HEADER") mapping("java", "SLASHSTAR_STYLE") exclude("*.json") + exclude("**/*.properties") exclude("**/*.xml") exclude("**/RollingList.java") exclude("**/api/**/*.java") diff --git a/hivemq-edge/src/main/java/com/hivemq/api/error/ApiExceptionMapper.java b/hivemq-edge/src/main/java/com/hivemq/api/error/ApiExceptionMapper.java index ac45b821bd..732b31eb4a 100644 --- a/hivemq-edge/src/main/java/com/hivemq/api/error/ApiExceptionMapper.java +++ b/hivemq-edge/src/main/java/com/hivemq/api/error/ApiExceptionMapper.java @@ -16,14 +16,14 @@ package com.hivemq.api.error; import com.hivemq.api.model.ApiErrorMessage; -import org.jetbrains.annotations.NotNull; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - +import com.hivemq.http.HttpConstants; import jakarta.ws.rs.core.MediaType; import jakarta.ws.rs.core.Response; import jakarta.ws.rs.ext.ExceptionMapper; import jakarta.ws.rs.ext.Provider; +import org.jetbrains.annotations.NotNull; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Mapper that handles StrongTyped ApiErrors and will respond with either the @@ -33,19 +33,18 @@ */ @Provider public class ApiExceptionMapper implements ExceptionMapper { - - private static final Logger logger = LoggerFactory.getLogger(ApiExceptionMapper.class); + private static final @NotNull Logger logger = LoggerFactory.getLogger(ApiExceptionMapper.class); @Override - public Response toResponse(final @NotNull ApiException exception) { + public @NotNull Response toResponse(final @NotNull ApiException exception) { logger.warn("Api Error Handled Api Exception Mapper {}", exception.getMessage(), exception.getCause()); - String message = exception.getMessage(); - ApiErrorMessage apiError = new ApiErrorMessage(); + final String message = exception.getMessage(); + final ApiErrorMessage apiError = new ApiErrorMessage(); apiError.setTitle(message); apiError.setFieldName(exception.getFieldName()); return Response.status(exception.getHttpStatusCode()) .entity(apiError) - .type(MediaType.APPLICATION_JSON_TYPE) + .type(HttpConstants.APPLICATION_PROBLEM_JSON_TYPE) .build(); } } diff --git a/hivemq-edge/src/main/java/com/hivemq/api/errors/ErrorFactory.java b/hivemq-edge/src/main/java/com/hivemq/api/errors/ErrorFactory.java new file mode 100644 index 0000000000..5d8152f7c5 --- /dev/null +++ b/hivemq-edge/src/main/java/com/hivemq/api/errors/ErrorFactory.java @@ -0,0 +1,33 @@ +/* + * Copyright 2019-present HiveMQ GmbH + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.hivemq.api.errors; + +import org.jetbrains.annotations.NotNull; + +import java.net.URI; + +public abstract class ErrorFactory { + private static final String CLASS_PREFIX = "com.hivemq"; + private static final String TYPE_PREFIX = "https://hivemq.com"; + + protected ErrorFactory() { + } + + protected static @NotNull URI type(final @NotNull Class clazz) { + return URI.create(TYPE_PREFIX + clazz.getName().substring(CLASS_PREFIX.length()).replace(".", "/")); + } +} diff --git a/hivemq-edge/src/main/java/com/hivemq/api/errors/HttpErrorFactory.java b/hivemq-edge/src/main/java/com/hivemq/api/errors/HttpErrorFactory.java new file mode 100644 index 0000000000..81bee57491 --- /dev/null +++ b/hivemq-edge/src/main/java/com/hivemq/api/errors/HttpErrorFactory.java @@ -0,0 +1,128 @@ +/* + * Copyright 2019-present HiveMQ GmbH + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.hivemq.api.errors; + +import com.hivemq.common.i18n.I18nHttpError; +import com.hivemq.edge.api.model.*; +import com.hivemq.edge.api.model.InsufficientStorageError; +import com.hivemq.edge.api.model.InternalServerError; +import com.hivemq.edge.api.model.InvalidQueryParameterError; +import com.hivemq.edge.api.model.TemporaryNotAvailableError; +import com.hivemq.edge.api.model.UrlParameterMissingError; +import com.hivemq.http.HttpStatus; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.Map; + +public final class HttpErrorFactory extends ErrorFactory { + private HttpErrorFactory() { + super(); + } + + public static @NotNull InsufficientStorageError insufficientStorageError() { + return insufficientStorageError(null); + } + + public static @NotNull InsufficientStorageError insufficientStorageError(final @Nullable String reason) { + return InsufficientStorageError.builder() + .type(type(InsufficientStorageError.class)) + .title(I18nHttpError.HTTP_ERROR_507_TITLE.get()) + .detail(reason == null ? + I18nHttpError.HTTP_ERROR_507_DETAIL.get() : + I18nHttpError.HTTP_ERROR_507_DETAIL_WITH_REASON.get(Map.of("reason", reason))) + .status(HttpStatus.INSUFFICIENT_STORAGE_507) + .build(); + } + + public static @NotNull InternalServerError internalServerError() { + return internalServerError(null); + } + + public static @NotNull InternalServerError internalServerError(final @Nullable String reason) { + return InternalServerError.builder() + .type(type(InternalServerError.class)) + .title(I18nHttpError.HTTP_ERROR_500_TITLE.get()) + .detail(reason == null ? + I18nHttpError.HTTP_ERROR_500_DETAIL.get() : + I18nHttpError.HTTP_ERROR_500_DETAIL_WITH_REASON.get(Map.of("reason", reason))) + .status(HttpStatus.INTERNAL_SERVER_ERROR_500) + .build(); + } + + public static @NotNull InvalidQueryParameterError invalidQueryParameterError( + final @NotNull String parameter, + final @NotNull String reason) { + return InvalidQueryParameterError.builder() + .type(type(InvalidQueryParameterError.class)) + .title(I18nHttpError.HTTP_ERROR_400_INVALID_QUERY_PARAMETER_TITLE.get()) + .detail(I18nHttpError.HTTP_ERROR_400_INVALID_QUERY_PARAMETER_DETAIL_WITH_PARAMETER_AND_REASON.get(Map.of( + "parameter", parameter, + "reason", reason))) + .parameter(parameter) + .status(HttpStatus.BAD_REQUEST_400) + .build(); + } + + public static @NotNull PreconditionFailedError preconditionFailedError( + final @NotNull String reason) { + return PreconditionFailedError.builder() + .type(type(PreconditionFailedError.class)) + .title(I18nHttpError.HTTP_ERROR_412_TITLE.get()) + .detail(I18nHttpError.HTTP_ERROR_412_DETAIL_WITH_REASON.get(Map.of("reason", reason))) + .status(HttpStatus.PRECONDITION_FAILED_412) + .build(); + } + + public static @NotNull RequestBodyMissingError requestBodyMissingError() { + return RequestBodyMissingError.builder() + .type(type(RequestBodyMissingError.class)) + .title(I18nHttpError.HTTP_ERROR_400_REQUEST_BODY_MISSING_TITLE.get()) + .detail(I18nHttpError.HTTP_ERROR_400_REQUEST_BODY_MISSING_DETAIL.get()) + .status(HttpStatus.BAD_REQUEST_400) + .build(); + } + + public static @NotNull RequestBodyParameterMissingError requestBodyParameterMissingError(final @NotNull String parameter) { + return RequestBodyParameterMissingError.builder() + .type(type(RequestBodyParameterMissingError.class)) + .title(I18nHttpError.HTTP_ERROR_400_REQUEST_BODY_PARAMETER_MISSING_TITLE.get()) + .detail(I18nHttpError.HTTP_ERROR_400_REQUEST_BODY_PARAMETER_MISSING_DETAIL_WITH_PARAMETER.get(Map.of("parameter", parameter))) + .parameter(parameter) + .status(HttpStatus.BAD_REQUEST_400) + .build(); + } + + public static @NotNull TemporaryNotAvailableError temporaryNotAvailableError() { + return TemporaryNotAvailableError.builder() + .type(type(TemporaryNotAvailableError.class)) + .title(I18nHttpError.HTTP_ERROR_503_TITLE.get()) + .detail(I18nHttpError.HTTP_ERROR_503_DETAIL.get()) + .status(HttpStatus.SERVICE_UNAVAILABLE_503) + .build(); + } + + public static @NotNull UrlParameterMissingError urlParameterMissingError(final @NotNull String parameter) { + return UrlParameterMissingError.builder() + .type(type(UrlParameterMissingError.class)) + .title(I18nHttpError.HTTP_ERROR_400_URL_PARAMETER_MISSING_TITLE.get()) + .detail(I18nHttpError.HTTP_ERROR_400_URL_PARAMETER_MISSING_DETAIL_WITH_PARAMETER.get(Map.of("parameter", parameter))) + .parameter(parameter) + .status(HttpStatus.BAD_REQUEST_400) + .build(); + } +} diff --git a/hivemq-edge/src/main/java/com/hivemq/api/errors/PreconditionFailedError.java b/hivemq-edge/src/main/java/com/hivemq/api/errors/PreconditionFailedError.java deleted file mode 100644 index 52da173129..0000000000 --- a/hivemq-edge/src/main/java/com/hivemq/api/errors/PreconditionFailedError.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2019-present HiveMQ GmbH - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.hivemq.api.errors; - -import com.hivemq.http.HttpStatus; -import com.hivemq.http.error.Error; -import com.hivemq.http.error.ProblemDetails; -import org.jetbrains.annotations.NotNull; - -import java.util.List; - -public class PreconditionFailedError extends ProblemDetails { - public PreconditionFailedError( - final @NotNull String cause) { - super( - "PreconditionFailed", - "Precondition Failed", - "A precondition required for fulfilling the request was not fulfilled", - HttpStatus.PRECONDITION_FAILED_412, - List.of(new Error(cause))); - } -} diff --git a/hivemq-edge/src/main/java/com/hivemq/api/errors/ValidationErrorFactory.java b/hivemq-edge/src/main/java/com/hivemq/api/errors/ValidationErrorFactory.java new file mode 100644 index 0000000000..39fc260a87 --- /dev/null +++ b/hivemq-edge/src/main/java/com/hivemq/api/errors/ValidationErrorFactory.java @@ -0,0 +1,168 @@ +/* + * Copyright 2019-present HiveMQ GmbH + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.hivemq.api.errors; + +import com.hivemq.edge.api.model.AtLeastOneFieldMissingValidationError; +import com.hivemq.edge.api.model.EmptyFieldValidationError; +import com.hivemq.edge.api.model.InvalidFieldLengthValidationError; +import com.hivemq.edge.api.model.InvalidFieldValueValidationError; +import com.hivemq.edge.api.model.InvalidIdentifierValidationError; +import com.hivemq.edge.api.model.MissingFieldValidationError; +import com.hivemq.edge.api.model.UnsupportedFieldValidationError; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.List; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +public final class ValidationErrorFactory extends ErrorFactory { + private ValidationErrorFactory() { + super(); + } + + public static @NotNull AtLeastOneFieldMissingValidationError atLeastOneFieldMissingValidationError(final @NotNull String... paths) { + return AtLeastOneFieldMissingValidationError.builder() + .type(type(AtLeastOneFieldMissingValidationError.class)) + .detail("At least one of the fields must be present: " + + Stream.of(paths).map(path -> "'" + path + "'").collect(Collectors.joining(", ")) + + ".") + .paths(List.of(paths)) + .build(); + } + + public static @NotNull EmptyFieldValidationError emptyFieldValidationError( + final @NotNull String path) { + return emptyFieldValidationError("Required field '" + path + "' is empty.", path); + } + + public static @NotNull EmptyFieldValidationError emptyFieldValidationError( + final @NotNull String detail, + final @NotNull String path) { + return EmptyFieldValidationError.builder() + .type(type(EmptyFieldValidationError.class)) + .detail(detail) + .path(path) + .build(); + } + + public static @NotNull InvalidFieldLengthValidationError invalidFieldLengthValidationError( + final @NotNull String detail, + final @NotNull String path, + final @NotNull String value, + final int actualLength, + final int expectedMinimumLength, + final int expectedMaximumLength) { + return InvalidFieldLengthValidationError.builder() + .type(type(InvalidFieldLengthValidationError.class)) + .detail(detail) + .path(path) + .value(value) + .actualLength(actualLength) + .expectedMinimumLength(expectedMinimumLength) + .expectedMaximumLength(expectedMaximumLength) + .build(); + } + + public static @NotNull InvalidFieldValueValidationError invalidFieldValueValidationError( + final @NotNull String detail, + final @NotNull String path, + final @Nullable String value) { + return InvalidFieldValueValidationError.builder() + .type(type(InvalidFieldValueValidationError.class)) + .detail(detail) + .path(path) + .value(value) + .build(); + } + + public static @NotNull InvalidIdentifierValidationError invalidIdentifierValidationError( + final @NotNull String path, + final @NotNull String value) { + return invalidIdentifierValidationError("Identifier " + + path + + " must begin with a letter and may only consist of lowercase letters," + + " uppercase letters, numbers, periods, hyphens, and underscores", path, value); + } + + public static @NotNull InvalidIdentifierValidationError invalidIdentifierValidationError( + final @NotNull String detail, + final @NotNull String path, + final @NotNull String value) { + return InvalidIdentifierValidationError.builder() + .type(type(InvalidIdentifierValidationError.class)) + .detail(detail) + .path(path) + .value(value) + .build(); + } + + public static @NotNull MissingFieldValidationError missingFieldValidationError( + final @NotNull String path) { + return missingFieldValidationError("Required field '" + path + "' is missing.", path); + } + + public static @NotNull MissingFieldValidationError missingFieldValidationError( + final @NotNull String detail, + final @NotNull String path) { + return MissingFieldValidationError.builder() + .type(type(MissingFieldValidationError.class)) + .detail(detail) + .path(path) + .build(); + } + + public static @NotNull UnsupportedFieldValidationError unsupportedFieldValidationError( + final @NotNull String detail, + final @NotNull String path, + final @NotNull String actualValue, + final @NotNull String expectedValue) { + return UnsupportedFieldValidationError.builder() + .type(type(UnsupportedFieldValidationError.class)) + .detail(detail) + .path(path) + .actualValue(actualValue) + .expectedValue(expectedValue) + .build(); + } + + public static @NotNull UnsupportedFieldValidationError unsupportedFieldValidationErrorByType( + final @NotNull String path, + final @NotNull String actualType, + final @NotNull String expectedType) { + return unsupportedFieldValidationError("Unsupported type '" + + actualType + + " for field '" + + path + + "'. Expected type is '" + + expectedType + + "'.", path, actualType, expectedType); + } + + public static @NotNull UnsupportedFieldValidationError unsupportedFieldValidationErrorByValue( + final @NotNull String path, + final @NotNull String actualValue, + final @NotNull String expectedValue) { + return unsupportedFieldValidationError("Unsupported value '" + + actualValue + + " for field '" + + path + + "'. Expected value is '" + + expectedValue + + "'.", path, actualValue, expectedValue); + } +} diff --git a/hivemq-edge/src/main/java/com/hivemq/common/i18n/I18nError.java b/hivemq-edge/src/main/java/com/hivemq/common/i18n/I18nError.java new file mode 100644 index 0000000000..a3f755a175 --- /dev/null +++ b/hivemq-edge/src/main/java/com/hivemq/common/i18n/I18nError.java @@ -0,0 +1,33 @@ +/* + * Copyright 2019-present HiveMQ GmbH + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.hivemq.common.i18n; + +import org.jetbrains.annotations.NotNull; + +import java.util.Map; + +public interface I18nError { + default @NotNull String get() { + return get(Map.of()); + } + + @NotNull String get(final @NotNull Map map); + + @NotNull String getKey(); + + @NotNull String getName(); +} diff --git a/hivemq-edge/src/main/java/com/hivemq/common/i18n/I18nErrorTemplate.java b/hivemq-edge/src/main/java/com/hivemq/common/i18n/I18nErrorTemplate.java new file mode 100644 index 0000000000..b9c69187ff --- /dev/null +++ b/hivemq-edge/src/main/java/com/hivemq/common/i18n/I18nErrorTemplate.java @@ -0,0 +1,108 @@ +/* + * Copyright 2019-present HiveMQ GmbH + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.hivemq.common.i18n; + +import freemarker.cache.StringTemplateLoader; +import freemarker.template.Configuration; +import freemarker.template.Template; +import freemarker.template.TemplateException; +import org.apache.commons.io.IOUtils; +import org.jetbrains.annotations.NotNull; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.IOException; +import java.io.StringReader; +import java.io.StringWriter; +import java.nio.charset.StandardCharsets; +import java.util.Locale; +import java.util.Map; +import java.util.Properties; +import java.util.concurrent.ConcurrentHashMap; +import java.util.function.Function; + +/** + * Singleton class to manage OpenAPI i18n error templates using FreeMarker. + * It provides methods to retrieve error messages based on the current locale and template keys. + *

+ * This class is thread-safe and uses a cache to store configurations for different locales. + */ +public final class I18nErrorTemplate { + private static final @NotNull Logger LOGGER = LoggerFactory.getLogger(I18nErrorTemplate.class); + private final @NotNull Map configurationMap; + private final @NotNull Function resourceNameFunction; + private final @NotNull ClassLoader classLoader; + + public I18nErrorTemplate( + final @NotNull Function resourceNameFunction, + final @NotNull ClassLoader classLoader) { + configurationMap = new ConcurrentHashMap<>(); + this.classLoader = classLoader; + this.resourceNameFunction = resourceNameFunction; + } + + private Configuration createConfiguration(final @NotNull Locale locale) throws IOException { + final Configuration configuration = new Configuration(Configuration.VERSION_2_3_34); + final StringTemplateLoader stringTemplateLoader = new StringTemplateLoader(); + configuration.setDefaultEncoding(StandardCharsets.UTF_8.name()); + configuration.setTemplateLoader(stringTemplateLoader); + configuration.setLocale(locale); + final Properties properties = new Properties(); + final String resourceName = resourceNameFunction.apply(locale); + try (final StringReader stringReader = new StringReader(IOUtils.resourceToString(resourceName, + StandardCharsets.UTF_8, classLoader))) { + properties.load(stringReader); + } + for (final Map.Entry entry : properties.entrySet()) { + stringTemplateLoader.putTemplate(String.valueOf(entry.getKey()), String.valueOf(entry.getValue())); + } + return configuration; + } + + public @NotNull String get(final @NotNull I18nError i18NError) { + return get(i18NError, Map.of()); + } + + public @NotNull String get(final @NotNull I18nError i18NError, final @NotNull Map map) { + final Locale locale = I18nLocaleContext.getLocale(); + try { + Configuration configuration = configurationMap.get(locale.toString()); + if (configuration == null) { + // The whole configuration creation process is not thread-safe, but creating a new configuration + // multiple times among concurrent threads brings no harm. + // So, we don't use a lock here to improve the overall performance. + configuration = createConfiguration(locale); + configurationMap.put(locale.toString(), configuration); + } + final Template template = configuration.getTemplate(i18NError.getKey()); + try (final StringWriter stringWriter = new StringWriter()) { + template.process(map, stringWriter); + return stringWriter.toString(); + } + } catch (final TemplateException e) { + final String errorMessage = + "Error: Template " + i18NError.getKey() + " for " + locale + " could not be processed."; + LOGGER.error(errorMessage, e); + return errorMessage; + } catch (final IOException e) { + final String errorMessage = + "Error: Template " + i18NError.getKey() + " for " + locale + " could not be loaded."; + LOGGER.error(errorMessage, e); + return errorMessage; + } + } +} diff --git a/hivemq-edge/src/main/java/com/hivemq/common/i18n/I18nHttpError.java b/hivemq-edge/src/main/java/com/hivemq/common/i18n/I18nHttpError.java new file mode 100644 index 0000000000..d65f71749c --- /dev/null +++ b/hivemq-edge/src/main/java/com/hivemq/common/i18n/I18nHttpError.java @@ -0,0 +1,70 @@ +/* + * Copyright 2019-present HiveMQ GmbH + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.hivemq.common.i18n; + +import org.jetbrains.annotations.NotNull; + +import java.util.Map; + +public enum I18nHttpError implements I18nError { + HTTP_ERROR_400_INVALID_QUERY_PARAMETER_DETAIL_WITH_PARAMETER_AND_REASON, + HTTP_ERROR_400_INVALID_QUERY_PARAMETER_TITLE, + HTTP_ERROR_400_REQUEST_BODY_MISSING_DETAIL, + HTTP_ERROR_400_REQUEST_BODY_MISSING_TITLE, + HTTP_ERROR_400_REQUEST_BODY_PARAMETER_MISSING_DETAIL_WITH_PARAMETER, + HTTP_ERROR_400_REQUEST_BODY_PARAMETER_MISSING_TITLE, + HTTP_ERROR_400_URL_PARAMETER_MISSING_DETAIL_WITH_PARAMETER, + HTTP_ERROR_400_URL_PARAMETER_MISSING_TITLE, + HTTP_ERROR_412_DETAIL_WITH_REASON, + HTTP_ERROR_412_TITLE, + HTTP_ERROR_500_DETAIL, + HTTP_ERROR_500_DETAIL_WITH_REASON, + HTTP_ERROR_500_TITLE, + HTTP_ERROR_503_DETAIL, + HTTP_ERROR_503_TITLE, + HTTP_ERROR_507_DETAIL, + HTTP_ERROR_507_DETAIL_WITH_REASON, + HTTP_ERROR_507_TITLE, + ; + + private static final @NotNull String RESOURCE_NAME_PREFIX = "templates/http-errors-"; + private static final @NotNull String RESOURCE_NAME_SUFFIX = ".properties"; + private static final @NotNull I18nErrorTemplate TEMPLATE = + new I18nErrorTemplate(locale -> RESOURCE_NAME_PREFIX + locale + RESOURCE_NAME_SUFFIX, + I18nHttpError.class.getClassLoader()); + + private final @NotNull String key; + + I18nHttpError() { + key = name().toLowerCase().replace("_", "."); + } + + @Override + public @NotNull String get(final @NotNull Map map) { + return TEMPLATE.get(this, map); + } + + @Override + public @NotNull String getKey() { + return key; + } + + @Override + public @NotNull String getName() { + return name(); + } +} diff --git a/hivemq-edge/src/main/java/com/hivemq/common/i18n/I18nLocaleContext.java b/hivemq-edge/src/main/java/com/hivemq/common/i18n/I18nLocaleContext.java new file mode 100644 index 0000000000..f52258e378 --- /dev/null +++ b/hivemq-edge/src/main/java/com/hivemq/common/i18n/I18nLocaleContext.java @@ -0,0 +1,36 @@ +/* + * Copyright 2019-present HiveMQ GmbH + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.hivemq.common.i18n; + +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.Locale; + +public final class I18nLocaleContext { + public static @NotNull Locale DEFAULT_LOCALE = Locale.US; + + private static final ThreadLocal THREAD_LOCAL_LOCALE = ThreadLocal.withInitial(() -> DEFAULT_LOCALE); + + public static @NotNull Locale getLocale() { + return THREAD_LOCAL_LOCALE.get(); + } + + public static void setLocale(final @Nullable Locale locale) { + THREAD_LOCAL_LOCALE.set(locale == null ? DEFAULT_LOCALE : locale); + } +} diff --git a/hivemq-edge/src/main/java/com/hivemq/http/HttpConstants.java b/hivemq-edge/src/main/java/com/hivemq/http/HttpConstants.java index 2d1d677b42..f6a87ea294 100644 --- a/hivemq-edge/src/main/java/com/hivemq/http/HttpConstants.java +++ b/hivemq-edge/src/main/java/com/hivemq/http/HttpConstants.java @@ -16,6 +16,8 @@ package com.hivemq.http; import com.hivemq.http.error.ErrorType; +import jakarta.ws.rs.core.MediaType; +import org.jetbrains.annotations.NotNull; import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; @@ -28,27 +30,29 @@ enum METHOD { GET, POST, HEAD, PUT, DELETE, OPTIONS, CONNECT, TRACE, PATCH } - String SLASH = "/"; - String HTTP = "http"; - String HTTPS = "https"; - String PROTOCOL_SEP = "://"; - String DEFAULT_DATE_FORMAT = "yyyy-MM-dd HH:mm:ss"; - String HTTP_URL_REGEX = "https?:\\/\\/(?:w{1,3}\\.)?[^\\s.]+(?:\\.[a-z]+)*(?::\\d+)?((?:\\/\\w+)|(?:-\\w+))*\\/?(?![^<]*(?:<\\/\\w+>|\\/?>))"; - Charset DEFAULT_CHARSET = StandardCharsets.UTF_8; - String CONTENT_TYPE_HEADER = "Content-Type"; - String USER_AGENT_HEADER = "User-Agent"; - String CONTENT_ENCODING_HEADER = "Content-Encoding"; - String LOCATION_HEADER = "Location"; - String AUTH_HEADER = "Authorization"; - String BASIC_AUTH_CHALLENGE_HEADER = "WWW-Authenticate"; - String BEARER_TOKEN_HEADER = "Bearer %s"; - String BASIC_AUTH_HEADER = "Basic %s"; - String BASIC_AUTH_REALM = "Basic realm=\"%s\""; - String HTML_MIME_TYPE = "text/html"; - String PLAIN_MIME_TYPE = "text/plain"; - String JSON_MIME_TYPE = "application/json"; - String BASE64_ENCODED_VALUE = "data:%s;base64,%s"; - String DEFAULT_MIME_TYPE = HTML_MIME_TYPE; + @NotNull String SLASH = "/"; + @NotNull String HTTP = "http"; + @NotNull String HTTPS = "https"; + @NotNull String PROTOCOL_SEP = "://"; + @NotNull String DEFAULT_DATE_FORMAT = "yyyy-MM-dd HH:mm:ss"; + @NotNull String HTTP_URL_REGEX = "https?:\\/\\/(?:w{1,3}\\.)?[^\\s.]+(?:\\.[a-z]+)*(?::\\d+)?((?:\\/\\w+)|(?:-\\w+))*\\/?(?![^<]*(?:<\\/\\w+>|\\/?>))"; + @NotNull Charset DEFAULT_CHARSET = StandardCharsets.UTF_8; + @NotNull String CONTENT_TYPE_HEADER = "Content-Type"; + @NotNull String USER_AGENT_HEADER = "User-Agent"; + @NotNull String CONTENT_ENCODING_HEADER = "Content-Encoding"; + @NotNull String LOCATION_HEADER = "Location"; + @NotNull String AUTH_HEADER = "Authorization"; + @NotNull String BASIC_AUTH_CHALLENGE_HEADER = "WWW-Authenticate"; + @NotNull String BEARER_TOKEN_HEADER = "Bearer %s"; + @NotNull String BASIC_AUTH_HEADER = "Basic %s"; + @NotNull String BASIC_AUTH_REALM = "Basic realm=\"%s\""; + @NotNull String HTML_MIME_TYPE = "text/html"; + @NotNull String PLAIN_MIME_TYPE = "text/plain"; + @NotNull String JSON_MIME_TYPE = "application/json"; + @NotNull String BASE64_ENCODED_VALUE = "data:%s;base64,%s"; + @NotNull String DEFAULT_MIME_TYPE = HTML_MIME_TYPE; + @NotNull String APPLICATION_PROBLEM_JSON_CHARSET_UTF_8 = "application/problem+json;charset=utf-8"; + @NotNull MediaType APPLICATION_PROBLEM_JSON_TYPE = new MediaType("application", "problem+json", "utf-8"); int SC_CONTINUE = 100; int SC_SWITCHING_PROTOCOLS = 101; @@ -92,7 +96,7 @@ enum METHOD { int SC_GATEWAY_TIMEOUT = 504; int SC_HTTP_VERSION_NOT_SUPPORTED = 505; - Map MIME_MAP = new HashMap(){{ + @NotNull Map MIME_MAP = new HashMap<>(){{ put("appcache", "text/cache-manifest"); put("css", "text/css"); put("woff", "font/woff"); diff --git a/hivemq-edge/src/main/java/com/hivemq/util/ErrorResponseUtil.java b/hivemq-edge/src/main/java/com/hivemq/util/ErrorResponseUtil.java index c0e228389d..9c68a56b72 100644 --- a/hivemq-edge/src/main/java/com/hivemq/util/ErrorResponseUtil.java +++ b/hivemq-edge/src/main/java/com/hivemq/util/ErrorResponseUtil.java @@ -15,22 +15,27 @@ */ package com.hivemq.util; +import com.hivemq.edge.api.model.ApiProblemDetails; +import com.hivemq.http.HttpConstants; import com.hivemq.http.error.ProblemDetails; -import org.jetbrains.annotations.NotNull; - import jakarta.ws.rs.core.Response; +import org.jetbrains.annotations.NotNull; /** * @author Christoph Schäbel */ public class ErrorResponseUtil { - + public static @NotNull Response errorResponse(final @NotNull ApiProblemDetails error) { + return Response.status(error.getStatus()) + .entity(error) + .type(HttpConstants.APPLICATION_PROBLEM_JSON_TYPE) + .build(); + } public static @NotNull Response errorResponse(final @NotNull ProblemDetails errors) { return Response.status(errors.getStatus()) .entity(errors) - .header("Content-Type", "application/json;charset=utf-8") + .type(HttpConstants.APPLICATION_PROBLEM_JSON_TYPE) .build(); } - } diff --git a/hivemq-edge/src/main/resources/templates/http-errors-en_US.properties b/hivemq-edge/src/main/resources/templates/http-errors-en_US.properties new file mode 100644 index 0000000000..b5ec3c5a00 --- /dev/null +++ b/hivemq-edge/src/main/resources/templates/http-errors-en_US.properties @@ -0,0 +1,18 @@ +http.error.400.invalid.query.parameter.detail.with.parameter.and.reason=Query parameter '${parameter}' is invalid: ${reason} +http.error.400.invalid.query.parameter.title=Query Parameter is Invalid +http.error.400.request.body.missing.detail=Required request body is missing. +http.error.400.request.body.missing.title=Required Request Body Missing +http.error.400.request.body.parameter.missing.detail.with.parameter=Required request body parameter '${parameter}' is missing. +http.error.400.request.body.parameter.missing.title=Required Request Body Parameter Missing +http.error.400.url.parameter.missing.detail.with.parameter=Required URL parameter '${parameter}' is missing. +http.error.400.url.parameter.missing.title=Required URL Parameter Missing +http.error.412.detail.with.reason=A precondition required for fulfilling the request was not fulfilled: ${reason} +http.error.412.title=Precondition Failed +http.error.500.detail=An unexpected error occurred, check the logs. +http.error.500.detail.with.reason=An unexpected error occurred: ${reason} +http.error.500.title=Internal Server Error +http.error.503.detail=The endpoint is temporarily not available, please try again later. +http.error.503.title=Endpoint Temporarily not Available +http.error.507.detail=Insufficient Storage. +http.error.507.detail.with.reason=Insufficient Storage: ${reason} +http.error.507.title=Insufficient Storage diff --git a/hivemq-edge/src/test/java/com/hivemq/api/auth/BearerTokenAuthTests.java b/hivemq-edge/src/test/java/com/hivemq/api/auth/BearerTokenAuthTests.java index 0818e5f3a4..54bf63c049 100644 --- a/hivemq-edge/src/test/java/com/hivemq/api/auth/BearerTokenAuthTests.java +++ b/hivemq-edge/src/test/java/com/hivemq/api/auth/BearerTokenAuthTests.java @@ -35,6 +35,7 @@ import com.hivemq.http.core.HttpUrlConnectionClient; import com.hivemq.http.core.HttpUtils; import com.hivemq.http.error.ProblemDetails; +import jakarta.ws.rs.core.MediaType; import org.glassfish.jersey.server.ResourceConfig; import org.junit.AfterClass; import org.junit.Assert; @@ -44,7 +45,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import jakarta.ws.rs.core.MediaType; import java.io.ByteArrayInputStream; import java.io.IOException; import java.util.HashSet; @@ -60,17 +60,14 @@ */ public class BearerTokenAuthTests { - protected final Logger logger = LoggerFactory.getLogger(BearerTokenAuthTests.class); - static final int TEST_HTTP_PORT = 8088; static final int CONNECT_TIMEOUT = 1000; static final int READ_TIMEOUT = 1000; static final String HTTP = "http"; - protected static JaxrsHttpServer server; - @Mock private static Injector injector; + protected final Logger logger = LoggerFactory.getLogger(BearerTokenAuthTests.class); @BeforeClass public static void setUp() throws Exception { @@ -86,7 +83,8 @@ public static void setUp() throws Exception { final ResourceConfig conf = new ResourceConfig() { { register(new ApiAuthenticationFeature(authenticationHandlers)); - }}; + } + }; conf.register(TestApiResource.class); conf.register(TestPermitAllApiResource.class); conf.register(TestResourceLevelRolesApiResource.class); @@ -132,17 +130,16 @@ public void testAuthenticateValidUser() throws IOException { @Test public void testAuthenticateInvalidUser() throws IOException { final ObjectMapper mapper = new ObjectMapper(); - final UsernamePasswordCredentials creds = + final UsernamePasswordCredentials credentials = new UsernamePasswordCredentials().userName("testuser").password("invalidpassword"); final HttpResponse response = HttpUrlConnectionClient.post(HttpUrlConnectionClient.JSON_HEADERS, getTestServerAddress(HTTP, TEST_HTTP_PORT, "api/v1/auth/authenticate"), - new ByteArrayInputStream(mapper.writeValueAsBytes(creds)), + new ByteArrayInputStream(mapper.writeValueAsBytes(credentials)), CONNECT_TIMEOUT, READ_TIMEOUT); - assertThat(response.getStatusCode()).as("Resource should NOT be accepted").isEqualTo(401); assertThat(response.getContentType()).as("API authenticate response should be json") - .startsWith(MediaType.APPLICATION_JSON); + .isEqualTo(HttpConstants.APPLICATION_PROBLEM_JSON_CHARSET_UTF_8); assertThat(mapper.readValue(response.getResponseBody(), ProblemDetails.class) .getErrors() .get(0) @@ -154,7 +151,8 @@ public void testAuthenticateInvalidUser() throws IOException { public void testAuthenticatedTokenAllowsApiAccess() throws IOException { final ObjectMapper mapper = new ObjectMapper(); - final UsernamePasswordCredentials creds = new UsernamePasswordCredentials().userName("testuser").password("test"); + final UsernamePasswordCredentials creds = + new UsernamePasswordCredentials().userName("testuser").password("test"); HttpResponse response = HttpUrlConnectionClient.post(HttpUrlConnectionClient.JSON_HEADERS, getTestServerAddress(HTTP, TEST_HTTP_PORT, "api/v1/auth/authenticate"), new ByteArrayInputStream(mapper.writeValueAsBytes(creds)), diff --git a/hivemq-edge/src/test/java/com/hivemq/api/auth/ChainedAuthTests.java b/hivemq-edge/src/test/java/com/hivemq/api/auth/ChainedAuthTests.java index 50b72ff0e9..d26f1f62cb 100644 --- a/hivemq-edge/src/test/java/com/hivemq/api/auth/ChainedAuthTests.java +++ b/hivemq-edge/src/test/java/com/hivemq/api/auth/ChainedAuthTests.java @@ -36,6 +36,7 @@ import com.hivemq.http.core.HttpUrlConnectionClient; import com.hivemq.http.core.HttpUtils; import com.hivemq.http.error.ProblemDetails; +import jakarta.ws.rs.core.MediaType; import org.glassfish.jersey.server.ResourceConfig; import org.jetbrains.annotations.NotNull; import org.junit.AfterClass; @@ -45,7 +46,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import jakarta.ws.rs.core.MediaType; import java.io.ByteArrayInputStream; import java.io.IOException; import java.util.HashSet; @@ -61,14 +61,12 @@ */ public class ChainedAuthTests { - protected final Logger logger = LoggerFactory.getLogger(ChainedAuthTests.class); - static final int TEST_HTTP_PORT = 8088; static final int CONNECT_TIMEOUT = 1000; static final int READ_TIMEOUT = 1000; static final String HTTP = "http"; - protected static @NotNull JaxrsHttpServer server; + protected final Logger logger = LoggerFactory.getLogger(ChainedAuthTests.class); @BeforeClass public static void setUp() throws Exception { @@ -115,7 +113,8 @@ protected static String getTestServerAddress(final @NotNull String protocol, fin public void testAuthenticateValidUser() throws IOException { final ObjectMapper mapper = new ObjectMapper(); - final UsernamePasswordCredentials creds = new UsernamePasswordCredentials().userName("testuser").password("test"); + final UsernamePasswordCredentials creds = + new UsernamePasswordCredentials().userName("testuser").password("test"); final HttpResponse response = HttpUrlConnectionClient.post(HttpUrlConnectionClient.JSON_HEADERS, getTestServerAddress(HTTP, TEST_HTTP_PORT, "api/v1/auth/authenticate"), new ByteArrayInputStream(mapper.writeValueAsBytes(creds)), @@ -131,19 +130,17 @@ public void testAuthenticateValidUser() throws IOException { @Test public void testAuthenticateInvalidUser() throws IOException { - final ObjectMapper mapper = new ObjectMapper(); - final UsernamePasswordCredentials creds = + final UsernamePasswordCredentials credentials = new UsernamePasswordCredentials().userName("testuser").password("invalidpassword"); final HttpResponse response = HttpUrlConnectionClient.post(HttpUrlConnectionClient.JSON_HEADERS, getTestServerAddress(HTTP, TEST_HTTP_PORT, "api/v1/auth/authenticate"), - new ByteArrayInputStream(mapper.writeValueAsBytes(creds)), + new ByteArrayInputStream(mapper.writeValueAsBytes(credentials)), CONNECT_TIMEOUT, READ_TIMEOUT); - assertThat(response.getStatusCode()).as("Resource should NOT be accepted").isEqualTo(401); assertThat(response.getContentType()).as("API authenticate response should be json") - .startsWith(MediaType.APPLICATION_JSON); + .isEqualTo(HttpConstants.APPLICATION_PROBLEM_JSON_CHARSET_UTF_8); assertThat(mapper.readValue(response.getResponseBody(), ProblemDetails.class) .getErrors() .get(0) @@ -155,7 +152,8 @@ public void testAuthenticateInvalidUser() throws IOException { public void testAuthenticatedTokenAllowsApiAccess() throws IOException { final ObjectMapper mapper = new ObjectMapper(); - final UsernamePasswordCredentials creds = new UsernamePasswordCredentials().userName("testuser").password("test"); + final UsernamePasswordCredentials creds = + new UsernamePasswordCredentials().userName("testuser").password("test"); HttpResponse response = HttpUrlConnectionClient.post(HttpUrlConnectionClient.JSON_HEADERS, getTestServerAddress(HTTP, TEST_HTTP_PORT, "api/v1/auth/authenticate"), new ByteArrayInputStream(mapper.writeValueAsBytes(creds)), diff --git a/hivemq-edge/src/test/java/com/hivemq/common/i18n/I18nErrorTemplateTest.java b/hivemq-edge/src/test/java/com/hivemq/common/i18n/I18nErrorTemplateTest.java new file mode 100644 index 0000000000..fcd5f3ac4b --- /dev/null +++ b/hivemq-edge/src/test/java/com/hivemq/common/i18n/I18nErrorTemplateTest.java @@ -0,0 +1,30 @@ +/* + * Copyright 2019-present HiveMQ GmbH + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.hivemq.common.i18n; + + +import org.junit.jupiter.api.Test; + +import static org.assertj.core.api.Assertions.assertThat; + +public class I18nErrorTemplateTest { + @Test + public void whenLocaleIsNull_thenUseDefaultLocale() { + I18nLocaleContext.setLocale(null); + assertThat(I18nLocaleContext.getLocale()).isEqualTo(I18nLocaleContext.DEFAULT_LOCALE); + } +} diff --git a/hivemq-edge/src/test/java/com/hivemq/common/i18n/I18nHttpErrorTest.java b/hivemq-edge/src/test/java/com/hivemq/common/i18n/I18nHttpErrorTest.java new file mode 100644 index 0000000000..41cd9378c1 --- /dev/null +++ b/hivemq-edge/src/test/java/com/hivemq/common/i18n/I18nHttpErrorTest.java @@ -0,0 +1,128 @@ +/* + * Copyright 2019-present HiveMQ GmbH + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.hivemq.common.i18n; + +import org.apache.commons.io.IOUtils; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import java.io.IOException; +import java.io.StringReader; +import java.nio.charset.StandardCharsets; +import java.util.*; +import java.util.stream.Collectors; + +import static org.assertj.core.api.Assertions.assertThat; + +public class I18nHttpErrorTest { + @BeforeEach + public void setUp() { + I18nLocaleContext.setLocale(Locale.US); + } + + @AfterEach + public void tearDown() { + I18nLocaleContext.setLocale(I18nLocaleContext.DEFAULT_LOCALE); + } + + @Test + public void whenLocaleIsEnUS_thenErrorCountShouldMatch() throws IOException { + final List errors = Arrays.asList(I18nHttpError.values()); + assertThat(errors.size()).isGreaterThan(0); + final Properties properties = new Properties(); + try (final StringReader stringReader = new StringReader(IOUtils.resourceToString( + "templates/http-errors-en_US.properties", + StandardCharsets.UTF_8, + I18nHttpError.class.getClassLoader()))) { + properties.load(stringReader); + } + final Set propertyKeySet = properties.keySet(); + final Set errorKeySet = errors.stream().map(I18nHttpError::getKey).collect(Collectors.toSet()); + propertyKeySet.forEach(key -> { + assertThat(key).isInstanceOf(String.class); + assertThat(errorKeySet.contains((String) key)).as(key + " is not found in the enum.").isTrue(); + }); + errorKeySet.forEach(key -> assertThat(propertyKeySet.contains(key)).as(key + " is not found in the properties.") + .isTrue()); + } + + @Test + public void whenLocaleIsEnUS_thenHttpError400ShouldWork() { + assertThat(I18nHttpError.HTTP_ERROR_400_INVALID_QUERY_PARAMETER_TITLE.get()).isEqualTo( + "Query Parameter is Invalid"); + assertThat(I18nHttpError.HTTP_ERROR_400_INVALID_QUERY_PARAMETER_DETAIL_WITH_PARAMETER_AND_REASON.get(Map.of( + "parameter", + "p1", + "reason", + "test."))).isEqualTo("Query parameter 'p1' is invalid: test."); + assertThat(I18nHttpError.HTTP_ERROR_400_REQUEST_BODY_MISSING_TITLE.get()).isEqualTo( + "Required Request Body Missing"); + assertThat(I18nHttpError.HTTP_ERROR_400_REQUEST_BODY_MISSING_DETAIL.get()).isEqualTo( + "Required request body is missing."); + assertThat(I18nHttpError.HTTP_ERROR_400_REQUEST_BODY_PARAMETER_MISSING_TITLE.get()).isEqualTo( + "Required Request Body Parameter Missing"); + assertThat(I18nHttpError.HTTP_ERROR_400_REQUEST_BODY_PARAMETER_MISSING_DETAIL_WITH_PARAMETER.get(Map.of( + "parameter", + "p1"))).isEqualTo("Required request body parameter 'p1' is missing."); + assertThat(I18nHttpError.HTTP_ERROR_400_URL_PARAMETER_MISSING_TITLE.get()).isEqualTo( + "Required URL Parameter Missing"); + assertThat(I18nHttpError.HTTP_ERROR_400_URL_PARAMETER_MISSING_DETAIL_WITH_PARAMETER.get(Map.of("parameter", + "p1"))).isEqualTo("Required URL parameter 'p1' is missing."); + } + + @Test + public void whenLocaleIsEnUS_thenHttpError412ShouldWork() { + assertThat(I18nHttpError.HTTP_ERROR_412_TITLE.get()).isEqualTo("Precondition Failed"); + assertThat(I18nHttpError.HTTP_ERROR_412_DETAIL_WITH_REASON.get(Map.of("reason", "test."))).isEqualTo( + "A precondition required for fulfilling the request was not fulfilled: test."); + } + + @Test + public void whenLocaleIsEnUS_thenHttpError500ShouldWork() { + assertThat(I18nHttpError.HTTP_ERROR_500_TITLE.get()).isEqualTo("Internal Server Error"); + assertThat(I18nHttpError.HTTP_ERROR_500_DETAIL.get()).isEqualTo("An unexpected error occurred, check the logs."); + assertThat(I18nHttpError.HTTP_ERROR_500_DETAIL_WITH_REASON.get(Map.of("reason", "test."))).isEqualTo( + "An unexpected error occurred: test."); + } + + @Test + public void whenLocaleIsEnUS_thenHttpError503ShouldWork() { + assertThat(I18nHttpError.HTTP_ERROR_503_TITLE.get()).isEqualTo("Endpoint Temporarily not Available"); + assertThat(I18nHttpError.HTTP_ERROR_503_DETAIL.get()).isEqualTo( + "The endpoint is temporarily not available, please try again later."); + } + + @Test + public void whenLocaleIsEnUS_thenHttpError507ShouldWork() { + assertThat(I18nHttpError.HTTP_ERROR_507_TITLE.get()).isEqualTo("Insufficient Storage"); + assertThat(I18nHttpError.HTTP_ERROR_507_DETAIL.get()).isEqualTo("Insufficient Storage."); + assertThat(I18nHttpError.HTTP_ERROR_507_DETAIL_WITH_REASON.get(Map.of("reason", "test."))).isEqualTo( + "Insufficient Storage: test."); + } + + @Test + public void whenLocaleIsEnGB_thenHttpError500ShouldFail() { + I18nLocaleContext.setLocale(Locale.UK); + assertThat(I18nHttpError.HTTP_ERROR_500_TITLE.get()).isEqualTo( + "Error: Template http.error.500.title for en_GB could not be loaded."); + assertThat(I18nHttpError.HTTP_ERROR_500_DETAIL.get()).isEqualTo( + "Error: Template http.error.500.detail for en_GB could not be loaded."); + assertThat(I18nHttpError.HTTP_ERROR_500_DETAIL_WITH_REASON.get(Map.of("reason", "test."))).isEqualTo( + "Error: Template http.error.500.detail.with.reason for en_GB could not be loaded."); + } +}