diff --git a/src/lib/serviceRoutines/getEntities.c b/src/lib/serviceRoutines/getEntities.c index fe75482b..90e07c26 100644 --- a/src/lib/serviceRoutines/getEntities.c +++ b/src/lib/serviceRoutines/getEntities.c @@ -1629,7 +1629,7 @@ bool getEntities(void) } if (corNgsild.orderGeometry != NULL && strcmp(corNgsild.orderGeometry, "Point") != 0) { - ldError(501, LD_ERROR_OP_NOT_SUPPORTED, "Not Implemented", + ldError(422, LD_ERROR_OP_NOT_SUPPORTED, "Operation Not Supported", "sort by distance is only supported for a Point orderGeometry (got '%s')", corNgsild.orderGeometry); return true; } diff --git a/src/lib/serviceRoutines/getEntitiesTemporal.c b/src/lib/serviceRoutines/getEntitiesTemporal.c index 77355c4f..2d8d0c1e 100644 --- a/src/lib/serviceRoutines/getEntitiesTemporal.c +++ b/src/lib/serviceRoutines/getEntitiesTemporal.c @@ -579,7 +579,7 @@ bool getEntitiesTemporal(void) // if (filter.qSqlPredicate == NULL) { - ldError(501, LD_ERROR_OP_NOT_SUPPORTED, "Operation Not Supported", + ldError(422, LD_ERROR_OP_NOT_SUPPORTED, "Operation Not Supported", "this 'q' cannot be evaluated against the temporal store"); return true; } diff --git a/src/lib/troe/troeNotAvailable.c b/src/lib/troe/troeNotAvailable.c index 49dc4a4a..6846ccee 100644 --- a/src/lib/troe/troeNotAvailable.c +++ b/src/lib/troe/troeNotAvailable.c @@ -22,16 +22,21 @@ void troeNotAvailable(const char* op) // Two flavors: // - no TRoE wired in at all (alias is NULL or "none") → "started without TRoE support" // - a real plugin is active but doesn't implement this op → "plugin doesn't support op" - // 501 in either case: from the client's view the operation is not implemented - // by this server build/configuration. + // 422 in either case. From the client's view this IS "not implemented by this + // build", which reads like 501 - but TS 104-176 § 6.3.2 maps each error type to + // one status, and OperationNotSupported is 422. The only 501 in that table is + // NoMultiTenantSupport, a type reserved for one specific capability, so there + // is nothing registered that says "this deployment lacks an optional + // component" in general. See spec-doubts-2 #124; until it moves, the detail + // carries what the status cannot. if (strcmp(alias, "none") == 0) { - ldError(501, LD_ERROR_OP_NOT_SUPPORTED, "TRoE Not Available", + ldError(422, LD_ERROR_OP_NOT_SUPPORTED, "TRoE Not Available", "broker started without TRoE support; '%s' requires a TRoE plugin", op); } else { - ldError(501, LD_ERROR_OP_NOT_SUPPORTED, "TRoE Not Available", + ldError(422, LD_ERROR_OP_NOT_SUPPORTED, "TRoE Not Available", "TRoE plugin '%s' does not implement '%s'", alias, op); } } diff --git a/test/funcTests/cases/geo_orderby_distance.test b/test/funcTests/cases/geo_orderby_distance.test index 0aa2361a..a9641e4d 100644 --- a/test/funcTests/cases/geo_orderby_distance.test +++ b/test/funcTests/cases/geo_orderby_distance.test @@ -289,15 +289,15 @@ Content-Length: 189 07. dist-asc with a non-Point orderGeometry — 501 Not Implemented ================================================================= -HTTP/1.1 501 Not Implemented +HTTP/1.1 422 Unprocessable Content Date: REGEX(.*) Content-Type: application/json -Content-Length: 216 +Content-Length: 224 { "detail": "sort by distance is only supported for a Point orderGeometry (got 'LineString')", - "status": 501, - "title": "Not Implemented", + "status": 422, + "title": "Operation Not Supported", "type": "https://uri.etsi.org/ngsi-ld/errors/OperationNotSupported" } diff --git a/test/funcTests/cases/geo_orderby_distance_corDB.test b/test/funcTests/cases/geo_orderby_distance_corDB.test index 3aba46f1..b4bf9f28 100644 --- a/test/funcTests/cases/geo_orderby_distance_corDB.test +++ b/test/funcTests/cases/geo_orderby_distance_corDB.test @@ -285,15 +285,15 @@ Content-Length: 189 07. dist-asc with a non-Point orderGeometry — 501 Not Implemented ================================================================= -HTTP/1.1 501 Not Implemented +HTTP/1.1 422 Unprocessable Content Date: REGEX(.*) Content-Type: application/json -Content-Length: 216 +Content-Length: 224 { "detail": "sort by distance is only supported for a Point orderGeometry (got 'LineString')", - "status": 501, - "title": "Not Implemented", + "status": 422, + "title": "Operation Not Supported", "type": "https://uri.etsi.org/ngsi-ld/errors/OperationNotSupported" } diff --git a/test/funcTests/cases/local_param_distops_suppress.test b/test/funcTests/cases/local_param_distops_suppress.test index f2696804..6ff2406c 100644 --- a/test/funcTests/cases/local_param_distops_suppress.test +++ b/test/funcTests/cases/local_param_distops_suppress.test @@ -204,14 +204,14 @@ Content-Length: 152 08. GET /temporal/entities/urn:S1 — accepted (plugin layer 501 is fine) ======================================================================= -HTTP/1.1 501 Not Implemented +HTTP/1.1 422 Unprocessable Content Date: REGEX(.*) Content-Type: application/json Content-Length: REGEX(\d+) { "detail": "TRoE plugin 'ramdb' does not implement 'temporal-entity retrieve'", - "status": 501, + "status": 422, "title": "TRoE Not Available", "type": "https://uri.etsi.org/ngsi-ld/errors/OperationNotSupported" } @@ -220,14 +220,14 @@ Content-Length: REGEX(\d+) 09. GET /temporal/entities/urn:S1?local=true — accepted at API surface (regression: was 400) ============================================================================================= -HTTP/1.1 501 Not Implemented +HTTP/1.1 422 Unprocessable Content Date: REGEX(.*) Content-Type: application/json Content-Length: REGEX(\d+) { "detail": "TRoE plugin 'ramdb' does not implement 'temporal-entity retrieve'", - "status": 501, + "status": 422, "title": "TRoE Not Available", "type": "https://uri.etsi.org/ngsi-ld/errors/OperationNotSupported" } diff --git a/test/funcTests/cases/temporal_create_errors.test b/test/funcTests/cases/temporal_create_errors.test index 99a2d1a0..082b99d1 100644 --- a/test/funcTests/cases/temporal_create_errors.test +++ b/test/funcTests/cases/temporal_create_errors.test @@ -138,14 +138,14 @@ Content-Length: 182 04. valid URI but no TRoE plugin → 501 Not Implemented ======================================================= -HTTP/1.1 501 Not Implemented +HTTP/1.1 422 Unprocessable Content Date: REGEX(.*) Content-Type: application/json Content-Length: 224 { "detail": "broker started without TRoE support; 'temporal-entity create' requires a TRoE plugin", - "status": 501, + "status": 422, "title": "TRoE Not Available", "type": "https://uri.etsi.org/ngsi-ld/errors/OperationNotSupported" } diff --git a/test/funcTests/cases/troe_disabled_temporal_501.test b/test/funcTests/cases/troe_disabled_temporal_not_supported.test similarity index 69% rename from test/funcTests/cases/troe_disabled_temporal_501.test rename to test/funcTests/cases/troe_disabled_temporal_not_supported.test index 83c1f6c5..3873c6b6 100644 --- a/test/funcTests/cases/troe_disabled_temporal_501.test +++ b/test/funcTests/cases/troe_disabled_temporal_not_supported.test @@ -1,16 +1,16 @@ # -# FILE troe_disabled_temporal_501.test +# FILE troe_disabled_temporal_not_supported.test # # AUTHOR Ken Zangelin # # Copyright 2026 Seamware # # § 6.18 — a broker started without TRoE support has no temporal storage; a -# temporal-entity retrieve must be refused with 501 (Operation Not Supported), +# temporal-entity retrieve must be refused with 422 (Operation Not Supported), # not attempted. The broker here runs with the default TRoE (none). # --NAME-- -GET /temporal/entities with TRoE disabled → 501 Operation Not Supported +GET /temporal/entities with TRoE disabled → 422 Operation Not Supported --TAGS-- troe temporal @@ -21,7 +21,7 @@ coraineStart --RUN-- -echo "01. GET /temporal/entities/{id} — 501 (no TRoE backend)" +echo "01. GET /temporal/entities/{id} — 422 (no TRoE backend)" echo "=======================================================" corCurl --url /ngsi-ld/v1/temporal/entities/urn:ngsi-ld:T:1 echo @@ -29,16 +29,16 @@ echo --EXPECT-- -01. GET /temporal/entities/{id} — 501 (no TRoE backend) +01. GET /temporal/entities/{id} — 422 (no TRoE backend) ======================================================= -HTTP/1.1 501 Not Implemented +HTTP/1.1 422 Unprocessable Content Date: REGEX(.*) Content-Type: application/json Content-Length: 226 { "detail": "broker started without TRoE support; 'temporal-entity retrieve' requires a TRoE plugin", - "status": 501, + "status": 422, "title": "TRoE Not Available", "type": "https://uri.etsi.org/ngsi-ld/errors/OperationNotSupported" }