diff --git a/CHANGELOG.md b/CHANGELOG.md index 8b95bf151..f393f263a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## Naksha_2.2.31 +Added `UnprocessableEntity` error-code mapping to HTTP 422. + ## Naksha_2.2.30 - Updated the test HTTP client to use Vert.x. diff --git a/gradle.properties b/gradle.properties index 19b16c464..976d4bc85 100644 --- a/gradle.properties +++ b/gradle.properties @@ -11,5 +11,5 @@ mavenPassword=YourPassword # - here-naksha-lib-core/src/main/com/here/naksha/lib/core/NakshaVersion (static property: latest) # - here-naksha-app-service/src/main/resources/swagger/openapi.yaml (info.version property) # - CHANGELOG.md -version=2.2.30 +version=2.2.31 diff --git a/here-naksha-app-service/src/main/java/com/here/naksha/app/service/http/NakshaHttpVerticle.java b/here-naksha-app-service/src/main/java/com/here/naksha/app/service/http/NakshaHttpVerticle.java index f4c1c95c6..3ef9eefef 100644 --- a/here-naksha-app-service/src/main/java/com/here/naksha/app/service/http/NakshaHttpVerticle.java +++ b/here-naksha-app-service/src/main/java/com/here/naksha/app/service/http/NakshaHttpVerticle.java @@ -524,13 +524,15 @@ public void sendErrorResponse(@NotNull RoutingContext routingContext, @NotNull T } } - private @NotNull HttpResponseStatus mapErrorToHttpStatus(final @NotNull XyzError xyzError) { + static @NotNull HttpResponseStatus mapErrorToHttpStatus(final @NotNull XyzError xyzError) { if (xyzError.equals(XyzError.EXCEPTION)) { return HttpResponseStatus.INTERNAL_SERVER_ERROR; } else if (xyzError.equals(XyzError.NOT_IMPLEMENTED)) { return HttpResponseStatus.NOT_IMPLEMENTED; } else if (xyzError.equals(ILLEGAL_ARGUMENT)) { return HttpResponseStatus.BAD_REQUEST; + } else if (xyzError.equals(XyzError.UNPROCESSABLE_ENTITY)) { + return HttpResponseStatus.UNPROCESSABLE_ENTITY; } else if (xyzError.equals(XyzError.PAYLOAD_TOO_LARGE)) { return HttpResponseStatus.REQUEST_ENTITY_TOO_LARGE; } else if (xyzError.equals(XyzError.BAD_GATEWAY)) { diff --git a/here-naksha-app-service/src/main/resources/swagger/openapi.yaml b/here-naksha-app-service/src/main/resources/swagger/openapi.yaml index 8d85fb26d..9936a49f9 100644 --- a/here-naksha-app-service/src/main/resources/swagger/openapi.yaml +++ b/here-naksha-app-service/src/main/resources/swagger/openapi.yaml @@ -12,7 +12,7 @@ servers: info: title: "Naksha Hub-API" description: "Naksha Hub-API is a REST API to provide simple access to geo data." - version: "2.2.30" + version: "2.2.31" security: - AccessToken: [ ] @@ -90,6 +90,8 @@ paths: $ref: '#/components/responses/ErrorResponse403' '409': $ref: '#/components/responses/ErrorResponse409' + '422': + $ref: '#/components/responses/ErrorResponse422' '429': $ref: '#/components/responses/ErrorResponse429' '500': @@ -152,6 +154,8 @@ paths: $ref: '#/components/responses/ErrorResponse404' '409': $ref: '#/components/responses/ErrorResponse409' + '422': + $ref: '#/components/responses/ErrorResponse422' '429': $ref: '#/components/responses/ErrorResponse429' '500': @@ -235,6 +239,8 @@ paths: $ref: '#/components/responses/ErrorResponse403' '409': $ref: '#/components/responses/ErrorResponse409' + '422': + $ref: '#/components/responses/ErrorResponse422' '429': $ref: '#/components/responses/ErrorResponse429' '500': @@ -292,6 +298,8 @@ paths: $ref: '#/components/responses/ErrorResponse404' '409': $ref: '#/components/responses/ErrorResponse409' + '422': + $ref: '#/components/responses/ErrorResponse422' '429': $ref: '#/components/responses/ErrorResponse429' '500': @@ -375,6 +383,8 @@ paths: $ref: '#/components/responses/ErrorResponse403' '409': $ref: '#/components/responses/ErrorResponse409' + '422': + $ref: '#/components/responses/ErrorResponse422' '429': $ref: '#/components/responses/ErrorResponse429' '500': @@ -432,6 +442,8 @@ paths: $ref: '#/components/responses/ErrorResponse404' '409': $ref: '#/components/responses/ErrorResponse409' + '422': + $ref: '#/components/responses/ErrorResponse422' '429': $ref: '#/components/responses/ErrorResponse429' '500': @@ -542,6 +554,8 @@ paths: $ref: '#/components/responses/ErrorResponse404' '409': $ref: '#/components/responses/ErrorResponse409' + '422': + $ref: '#/components/responses/ErrorResponse422' '429': $ref: '#/components/responses/ErrorResponse429' '500': @@ -584,6 +598,8 @@ paths: $ref: '#/components/responses/ErrorResponse404' '409': $ref: '#/components/responses/ErrorResponse409' + '422': + $ref: '#/components/responses/ErrorResponse422' '429': $ref: '#/components/responses/ErrorResponse429' '500': @@ -680,6 +696,8 @@ paths: $ref: '#/components/responses/ErrorResponse404' '409': $ref: '#/components/responses/ErrorResponse409' + '422': + $ref: '#/components/responses/ErrorResponse422' '429': $ref: '#/components/responses/ErrorResponse429' '500': @@ -718,6 +736,8 @@ paths: $ref: '#/components/responses/ErrorResponse404' '409': $ref: '#/components/responses/ErrorResponse409' + '422': + $ref: '#/components/responses/ErrorResponse422' '429': $ref: '#/components/responses/ErrorResponse429' '500': @@ -911,6 +931,8 @@ paths: $ref: '#/components/responses/ErrorResponse403' '404': $ref: '#/components/responses/ErrorResponse404' + '422': + $ref: '#/components/responses/ErrorResponse422' '429': $ref: '#/components/responses/ErrorResponse429' '500': @@ -1536,6 +1558,12 @@ components: error: "Conflict" errorMessage: "Request conflicts with present state of resource on server side." streamId: "d5b2edaa-2c6b-44e1-b794-feea6fa0e15b" + ErrorResponse422: + description: The API request is well-formed, but its content cannot be processed due to semantic errors. + content: + application/json: + schema: + $ref: '#/components/schemas/Error' ErrorResponse429: description: Indicates request limit breach. content: diff --git a/here-naksha-lib-core/src/main/java/com/here/naksha/lib/core/NakshaVersion.java b/here-naksha-lib-core/src/main/java/com/here/naksha/lib/core/NakshaVersion.java index d46b57247..0596bb3bd 100644 --- a/here-naksha-lib-core/src/main/java/com/here/naksha/lib/core/NakshaVersion.java +++ b/here-naksha-lib-core/src/main/java/com/here/naksha/lib/core/NakshaVersion.java @@ -88,13 +88,14 @@ public class NakshaVersion implements Comparable { public static final String v2_2_28 = "2.2.28"; public static final String v2_2_29 = "2.2.29"; public static final String v2_2_30 = "2.2.30"; + public static final String v2_2_31 = "2.2.31"; /** * The latest version of the naksha-extension stored in the resources. */ @AvailableSince(v2_0_5) - public static final NakshaVersion latest = of(v2_2_30); + public static final NakshaVersion latest = of(v2_2_31); private final int major; private final int minor; diff --git a/here-naksha-lib-core/src/main/java/com/here/naksha/lib/core/models/XyzError.java b/here-naksha-lib-core/src/main/java/com/here/naksha/lib/core/models/XyzError.java index fe090e66b..5123fe765 100644 --- a/here-naksha-lib-core/src/main/java/com/here/naksha/lib/core/models/XyzError.java +++ b/here-naksha-lib-core/src/main/java/com/here/naksha/lib/core/models/XyzError.java @@ -99,6 +99,13 @@ public class XyzError extends JsonEnum { */ public static final XyzError ILLEGAL_ARGUMENT = defIgnoreCase(XyzError.class, "IllegalArgument"); + /** + * The request is syntactically valid, but its instructions cannot be processed. + * + *

This will result in a HTTP 422 Unprocessable Entity response. + */ + public static final XyzError UNPROCESSABLE_ENTITY = defIgnoreCase(XyzError.class, "UnprocessableEntity"); + /** * Any service or remote function required to process the request was not reachable. *