Skip to content

Commit e7b6d22

Browse files
authored
Unprocessable Error Code Entry. (#689)
* Unprocessable Error Code Entry. * Update description errorResponse. * Use errorCode in OpenAPI. * Bump up version.
1 parent 1f8b9bb commit e7b6d22

6 files changed

Lines changed: 45 additions & 4 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## Naksha_2.2.31
2+
Added `UnprocessableEntity` error-code mapping to HTTP 422.
3+
14
## Naksha_2.2.30
25
- Updated the test HTTP client to use Vert.x.
36

‎gradle.properties‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ mavenPassword=YourPassword
1111
# - here-naksha-lib-core/src/main/com/here/naksha/lib/core/NakshaVersion (static property: latest)
1212
# - here-naksha-app-service/src/main/resources/swagger/openapi.yaml (info.version property)
1313
# - CHANGELOG.md
14-
version=2.2.30
14+
version=2.2.31
1515

‎here-naksha-app-service/src/main/java/com/here/naksha/app/service/http/NakshaHttpVerticle.java‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -524,13 +524,15 @@ public void sendErrorResponse(@NotNull RoutingContext routingContext, @NotNull T
524524
}
525525
}
526526

527-
private @NotNull HttpResponseStatus mapErrorToHttpStatus(final @NotNull XyzError xyzError) {
527+
static @NotNull HttpResponseStatus mapErrorToHttpStatus(final @NotNull XyzError xyzError) {
528528
if (xyzError.equals(XyzError.EXCEPTION)) {
529529
return HttpResponseStatus.INTERNAL_SERVER_ERROR;
530530
} else if (xyzError.equals(XyzError.NOT_IMPLEMENTED)) {
531531
return HttpResponseStatus.NOT_IMPLEMENTED;
532532
} else if (xyzError.equals(ILLEGAL_ARGUMENT)) {
533533
return HttpResponseStatus.BAD_REQUEST;
534+
} else if (xyzError.equals(XyzError.UNPROCESSABLE_ENTITY)) {
535+
return HttpResponseStatus.UNPROCESSABLE_ENTITY;
534536
} else if (xyzError.equals(XyzError.PAYLOAD_TOO_LARGE)) {
535537
return HttpResponseStatus.REQUEST_ENTITY_TOO_LARGE;
536538
} else if (xyzError.equals(XyzError.BAD_GATEWAY)) {

‎here-naksha-app-service/src/main/resources/swagger/openapi.yaml‎

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ servers:
1212
info:
1313
title: "Naksha Hub-API"
1414
description: "Naksha Hub-API is a REST API to provide simple access to geo data."
15-
version: "2.2.30"
15+
version: "2.2.31"
1616

1717
security:
1818
- AccessToken: [ ]
@@ -90,6 +90,8 @@ paths:
9090
$ref: '#/components/responses/ErrorResponse403'
9191
'409':
9292
$ref: '#/components/responses/ErrorResponse409'
93+
'422':
94+
$ref: '#/components/responses/ErrorResponse422'
9395
'429':
9496
$ref: '#/components/responses/ErrorResponse429'
9597
'500':
@@ -152,6 +154,8 @@ paths:
152154
$ref: '#/components/responses/ErrorResponse404'
153155
'409':
154156
$ref: '#/components/responses/ErrorResponse409'
157+
'422':
158+
$ref: '#/components/responses/ErrorResponse422'
155159
'429':
156160
$ref: '#/components/responses/ErrorResponse429'
157161
'500':
@@ -235,6 +239,8 @@ paths:
235239
$ref: '#/components/responses/ErrorResponse403'
236240
'409':
237241
$ref: '#/components/responses/ErrorResponse409'
242+
'422':
243+
$ref: '#/components/responses/ErrorResponse422'
238244
'429':
239245
$ref: '#/components/responses/ErrorResponse429'
240246
'500':
@@ -292,6 +298,8 @@ paths:
292298
$ref: '#/components/responses/ErrorResponse404'
293299
'409':
294300
$ref: '#/components/responses/ErrorResponse409'
301+
'422':
302+
$ref: '#/components/responses/ErrorResponse422'
295303
'429':
296304
$ref: '#/components/responses/ErrorResponse429'
297305
'500':
@@ -375,6 +383,8 @@ paths:
375383
$ref: '#/components/responses/ErrorResponse403'
376384
'409':
377385
$ref: '#/components/responses/ErrorResponse409'
386+
'422':
387+
$ref: '#/components/responses/ErrorResponse422'
378388
'429':
379389
$ref: '#/components/responses/ErrorResponse429'
380390
'500':
@@ -432,6 +442,8 @@ paths:
432442
$ref: '#/components/responses/ErrorResponse404'
433443
'409':
434444
$ref: '#/components/responses/ErrorResponse409'
445+
'422':
446+
$ref: '#/components/responses/ErrorResponse422'
435447
'429':
436448
$ref: '#/components/responses/ErrorResponse429'
437449
'500':
@@ -542,6 +554,8 @@ paths:
542554
$ref: '#/components/responses/ErrorResponse404'
543555
'409':
544556
$ref: '#/components/responses/ErrorResponse409'
557+
'422':
558+
$ref: '#/components/responses/ErrorResponse422'
545559
'429':
546560
$ref: '#/components/responses/ErrorResponse429'
547561
'500':
@@ -584,6 +598,8 @@ paths:
584598
$ref: '#/components/responses/ErrorResponse404'
585599
'409':
586600
$ref: '#/components/responses/ErrorResponse409'
601+
'422':
602+
$ref: '#/components/responses/ErrorResponse422'
587603
'429':
588604
$ref: '#/components/responses/ErrorResponse429'
589605
'500':
@@ -680,6 +696,8 @@ paths:
680696
$ref: '#/components/responses/ErrorResponse404'
681697
'409':
682698
$ref: '#/components/responses/ErrorResponse409'
699+
'422':
700+
$ref: '#/components/responses/ErrorResponse422'
683701
'429':
684702
$ref: '#/components/responses/ErrorResponse429'
685703
'500':
@@ -718,6 +736,8 @@ paths:
718736
$ref: '#/components/responses/ErrorResponse404'
719737
'409':
720738
$ref: '#/components/responses/ErrorResponse409'
739+
'422':
740+
$ref: '#/components/responses/ErrorResponse422'
721741
'429':
722742
$ref: '#/components/responses/ErrorResponse429'
723743
'500':
@@ -911,6 +931,8 @@ paths:
911931
$ref: '#/components/responses/ErrorResponse403'
912932
'404':
913933
$ref: '#/components/responses/ErrorResponse404'
934+
'422':
935+
$ref: '#/components/responses/ErrorResponse422'
914936
'429':
915937
$ref: '#/components/responses/ErrorResponse429'
916938
'500':
@@ -1536,6 +1558,12 @@ components:
15361558
error: "Conflict"
15371559
errorMessage: "Request conflicts with present state of resource on server side."
15381560
streamId: "d5b2edaa-2c6b-44e1-b794-feea6fa0e15b"
1561+
ErrorResponse422:
1562+
description: The API request is well-formed, but its content cannot be processed due to semantic errors.
1563+
content:
1564+
application/json:
1565+
schema:
1566+
$ref: '#/components/schemas/Error'
15391567
ErrorResponse429:
15401568
description: Indicates request limit breach.
15411569
content:

‎here-naksha-lib-core/src/main/java/com/here/naksha/lib/core/NakshaVersion.java‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,14 @@ public class NakshaVersion implements Comparable<NakshaVersion> {
8888
public static final String v2_2_28 = "2.2.28";
8989
public static final String v2_2_29 = "2.2.29";
9090
public static final String v2_2_30 = "2.2.30";
91+
public static final String v2_2_31 = "2.2.31";
9192

9293

9394
/**
9495
* The latest version of the naksha-extension stored in the resources.
9596
*/
9697
@AvailableSince(v2_0_5)
97-
public static final NakshaVersion latest = of(v2_2_30);
98+
public static final NakshaVersion latest = of(v2_2_31);
9899

99100
private final int major;
100101
private final int minor;

‎here-naksha-lib-core/src/main/java/com/here/naksha/lib/core/models/XyzError.java‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,13 @@ public class XyzError extends JsonEnum {
9999
*/
100100
public static final XyzError ILLEGAL_ARGUMENT = defIgnoreCase(XyzError.class, "IllegalArgument");
101101

102+
/**
103+
* The request is syntactically valid, but its instructions cannot be processed.
104+
*
105+
* <p>This will result in a HTTP 422 Unprocessable Entity response.
106+
*/
107+
public static final XyzError UNPROCESSABLE_ENTITY = defIgnoreCase(XyzError.class, "UnprocessableEntity");
108+
102109
/**
103110
* Any service or remote function required to process the request was not reachable.
104111
*

0 commit comments

Comments
 (0)