Skip to content

Commit 52e6be8

Browse files
committed
HYPERFLEET-993 - feat: add typed error response models
1 parent cc6a1a9 commit 52e6be8

13 files changed

Lines changed: 801 additions & 187 deletions

File tree

.spectral.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ extends: ["spectral:oas"]
22
overrides:
33
- files:
44
- "schemas/core/openapi.yaml#/components/schemas/BearerAuth"
5-
- "schemas/gcp/openapi.yaml#/components/schemas/BearerAuth"
5+
- "schemas/core/openapi.yaml#/components/schemas/ForbiddenResponse"
66
rules:
77
oas3-unused-component: off

CHANGELOG.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [1.0.20] - 2026-06-02
11+
12+
### Fixed
13+
14+
- Typed error response models (`BadRequestResponse`, `UnauthorizedResponse`, `NotFoundResponse`, `ConflictResponse`) now emit an `application/problem+json` body schema per RFC 9457 (HYPERFLEET-993)
15+
- `UnauthorizedResponse` (401) added to all status and force-delete endpoints
16+
17+
### Changed
18+
19+
- `page` and `pageSize` query parameters have `@minValue(1)` constraints (HYPERFLEET-993)
20+
- Error models scoped to `namespace HyperFleet {}` block to avoid collision with TypeSpec.Http built-ins
21+
- Error example constants extracted to `shared/models/common/example_errors.tsp`
22+
1023
## [1.0.18] - 2026-05-26
1124

1225
### Changed
@@ -179,7 +192,8 @@ First official stable release of the HyperFleet API specification.
179192
- Interactive API documentation
180193

181194
<!-- Links -->
182-
[Unreleased]: https://github.com/openshift-hyperfleet/hyperfleet-api-spec/compare/v1.0.18...HEAD
195+
[Unreleased]: https://github.com/openshift-hyperfleet/hyperfleet-api-spec/compare/v1.0.20...HEAD
196+
[1.0.20]: https://github.com/openshift-hyperfleet/hyperfleet-api-spec/compare/v1.0.18...v1.0.20
183197
[1.0.18]: https://github.com/openshift-hyperfleet/hyperfleet-api-spec/compare/v1.0.17...v1.0.18
184198
[1.0.17]: https://github.com/openshift-hyperfleet/hyperfleet-api-spec/compare/v1.0.16...v1.0.17
185199
[1.0.16]: https://github.com/openshift-hyperfleet/hyperfleet-api-spec/compare/v1.0.15...v1.0.16

core/services/force-delete-internal.tsp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@ interface ClustersForceDelete {
2828
): {
2929
@statusCode statusCode: 204;
3030
} | Error
31-
| NotFoundResponse
3231
| BadRequestResponse
32+
| UnauthorizedResponse
33+
| NotFoundResponse
3334
| ConflictResponse;
3435
}
3536

@@ -54,7 +55,8 @@ interface NodePoolsForceDelete {
5455
): {
5556
@statusCode statusCode: 204;
5657
} | Error
57-
| NotFoundResponse
5858
| BadRequestResponse
59+
| UnauthorizedResponse
60+
| NotFoundResponse
5961
| ConflictResponse;
6062
}

core/services/resources-internal.tsp

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ interface Resources {
2424
@operationId("getResources")
2525
getResources(...QueryParams): Body<ResourceList>
2626
| Error
27-
| BadRequestResponse;
27+
| BadRequestResponse
28+
| UnauthorizedResponse;
2829

2930
/**
3031
* Returns a single resource by its ID.
@@ -38,8 +39,9 @@ interface Resources {
3839
@path resource_id: string,
3940
): Resource
4041
| Error
41-
| NotFoundResponse
42-
| BadRequestResponse;
42+
| BadRequestResponse
43+
| UnauthorizedResponse
44+
| NotFoundResponse;
4345

4446
/**
4547
* Create a new resource. Only top-level entity types (no parent) can be created
@@ -53,7 +55,8 @@ interface Resources {
5355
@statusCode statusCode: 201;
5456
@body resource: Resource;
5557
} | Error
56-
| BadRequestResponse;
58+
| BadRequestResponse
59+
| UnauthorizedResponse;
5760

5861
/**
5962
* Patch a resource by ID. Supports partial updates to spec, labels, and references.
@@ -67,8 +70,9 @@ interface Resources {
6770
@body body: ResourcePatchRequest,
6871
): Resource
6972
| Error
70-
| NotFoundResponse
7173
| BadRequestResponse
74+
| UnauthorizedResponse
75+
| NotFoundResponse
7276
| ConflictResponse;
7377

7478
/**
@@ -85,10 +89,11 @@ interface Resources {
8589
): {
8690
@statusCode statusCode: 202;
8791
@body resource: Resource;
88-
} | NotFoundResponse
89-
| ConflictResponse
90-
| Error
91-
| BadRequestResponse;
92+
} | Error
93+
| BadRequestResponse
94+
| UnauthorizedResponse
95+
| NotFoundResponse
96+
| ConflictResponse;
9297

9398
/**
9499
* Permanently removes the resource record from the database for a resource stuck in Finalizing state.
@@ -104,8 +109,9 @@ interface Resources {
104109
): {
105110
@statusCode statusCode: 204;
106111
} | Error
107-
| NotFoundResponse
108112
| BadRequestResponse
113+
| UnauthorizedResponse
114+
| NotFoundResponse
109115
| ConflictResponse;
110116
}
111117

@@ -125,8 +131,9 @@ interface ResourceStatuses {
125131
...QueryParams,
126132
): Body<AdapterStatusList>
127133
| Error
128-
| NotFoundResponse
129-
| BadRequestResponse;
134+
| BadRequestResponse
135+
| UnauthorizedResponse
136+
| NotFoundResponse;
130137

131138
@route("")
132139
@put
@@ -138,7 +145,8 @@ interface ResourceStatuses {
138145
@body body: AdapterStatusCreateRequest,
139146
):
140147
| (CreatedResponse & AdapterStatus)
148+
| Error
141149
| BadRequestResponse
142-
| NotFoundResponse
143-
| ConflictResponse;
150+
| UnauthorizedResponse
151+
| NotFoundResponse;
144152
}

core/services/statuses-internal.tsp

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,9 @@ interface ClusterStatuses {
3030
...QueryParams
3131
): Body<AdapterStatusList>
3232
| Error
33-
| NotFoundResponse
34-
| BadRequestResponse;
33+
| BadRequestResponse
34+
| UnauthorizedResponse
35+
| NotFoundResponse;
3536

3637
@route("")
3738
@put
@@ -47,9 +48,10 @@ interface ClusterStatuses {
4748
@body body: AdapterStatusCreateRequest,
4849
):
4950
| (CreatedResponse & AdapterStatus)
51+
| Error
5052
| BadRequestResponse
51-
| NotFoundResponse
52-
| ConflictResponse;
53+
| UnauthorizedResponse
54+
| NotFoundResponse;
5355
}
5456

5557
@tag("NodePool statuses")
@@ -72,8 +74,9 @@ interface NodePoolStatuses {
7274
...QueryParams
7375
): Body<AdapterStatusList>
7476
| Error
75-
| NotFoundResponse
76-
| BadRequestResponse;
77+
| BadRequestResponse
78+
| UnauthorizedResponse
79+
| NotFoundResponse;
7780

7881
@route("")
7982
@put
@@ -94,7 +97,9 @@ interface NodePoolStatuses {
9497
@body body: AdapterStatusCreateRequest,
9598
):
9699
| (CreatedResponse & AdapterStatus)
100+
| Error
97101
| BadRequestResponse
98-
| NotFoundResponse
99-
| ConflictResponse;
102+
| UnauthorizedResponse
103+
| NotFoundResponse;
100104
}
105+

main.tsp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ using OpenAPI;
3030
*/
3131
@service(#{ title: "HyperFleet API" })
3232
@info(#{
33-
version: "1.0.19",
33+
version: "1.0.20",
3434
contact: #{
3535
name: "HyperFleet Team",
3636
url: "https://github.com/openshift-hyperfleet",

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "hyperfleet",
3-
"version": "1.0.19",
3+
"version": "1.0.20",
44
"type": "module",
55
"exports": {
66
"./*": "./*"

0 commit comments

Comments
 (0)