@nxgt/typespec 0.9.0 → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/guide/errors.md +2 -0
- package/lib/errors.tsp +23 -0
- package/lib/headers.tsp +0 -23
- package/package.json +1 -1
package/docs/guide/errors.md
CHANGED
|
@@ -162,7 +162,9 @@ its own way, through `onValidationError`, turns that off with the generator's
|
|
|
162
162
|
| `Forbidden` | 403 | `ForbiddenBody` | authenticated, but not allowed; a `@nxgt/janus-hono` guard sends `AccessDenied` instead, and `janusErrors()` its own `{ code }` body ([Authentication](auth.md)) |
|
|
163
163
|
| `NotFound` | 404 | `NotFoundBody` | nothing is there |
|
|
164
164
|
| `Conflict` | 409 | `ConflictBody` | the request conflicts with the resource's state, such as a stale `version` |
|
|
165
|
+
| `IdempotencyInProgress` | 409 | `ConflictBody` | the first request with this `Idempotency-Key` still runs; with the `RateLimit-*` headers and `Retry-After` ([Headers](headers.md)) |
|
|
165
166
|
| `UnprocessableEntity` | 422 | `UnprocessableEntityBody` | well-formed, but not something the server can act on |
|
|
167
|
+
| `IdempotencyKeyReused` | 422 | `UnprocessableEntityBody` | an `Idempotency-Key` sent again with another body; with the `RateLimit-*` headers ([Headers](headers.md)) |
|
|
166
168
|
| `TooManyRequests` | 429 | `TooManyRequestsBody` | too many requests; with the `RateLimit-*` headers and `Retry-After` ([Headers](headers.md)) |
|
|
167
169
|
| `InternalServerError` | 500 | `InternalServerErrorBody` | the server failed; with `validateResponses`, `@nxgt/openapi-hono` sends it with `errors.response-validation-failed` when a reply breaks the spec |
|
|
168
170
|
| `ErrorResponse<Status>` | any | `ErrorBody<Status>` | any other status |
|
package/lib/errors.tsp
CHANGED
|
@@ -130,6 +130,29 @@ model TooManyRequests {
|
|
|
130
130
|
@body body: TooManyRequestsBody;
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
+
/**
|
|
134
|
+
* A request with this `Idempotency-Key` is still running. Retry it as it is,
|
|
135
|
+
* after `Retry-After`.
|
|
136
|
+
*/
|
|
137
|
+
@error
|
|
138
|
+
model IdempotencyInProgress {
|
|
139
|
+
@statusCode _: 409;
|
|
140
|
+
...RateLimitHeaders;
|
|
141
|
+
...RetryAfterHeader;
|
|
142
|
+
@body body: ConflictBody;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* This `Idempotency-Key` was already used for a request with another body. A
|
|
147
|
+
* new request takes a new key.
|
|
148
|
+
*/
|
|
149
|
+
@error
|
|
150
|
+
model IdempotencyKeyReused {
|
|
151
|
+
@statusCode _: 422;
|
|
152
|
+
...RateLimitHeaders;
|
|
153
|
+
@body body: UnprocessableEntityBody;
|
|
154
|
+
}
|
|
155
|
+
|
|
133
156
|
/**
|
|
134
157
|
* The server failed. With `validateResponses`, `@nxgt/openapi-hono` answers
|
|
135
158
|
* it too when a reply breaks the spec, with `errors.response-validation-failed`.
|
package/lib/headers.tsp
CHANGED
|
@@ -51,26 +51,3 @@ model RetryAfterHeader {
|
|
|
51
51
|
@header("Retry-After")
|
|
52
52
|
retryAfter?: integer;
|
|
53
53
|
}
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* A request with this `Idempotency-Key` is still running. Retry it as it is,
|
|
57
|
-
* after `Retry-After`.
|
|
58
|
-
*/
|
|
59
|
-
@error
|
|
60
|
-
model IdempotencyInProgress {
|
|
61
|
-
@statusCode _: 409;
|
|
62
|
-
...RateLimitHeaders;
|
|
63
|
-
...RetryAfterHeader;
|
|
64
|
-
@body body: ConflictBody;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* This `Idempotency-Key` was already used for a request with another body. A
|
|
69
|
-
* new request takes a new key.
|
|
70
|
-
*/
|
|
71
|
-
@error
|
|
72
|
-
model IdempotencyKeyReused {
|
|
73
|
-
@statusCode _: 422;
|
|
74
|
-
...RateLimitHeaders;
|
|
75
|
-
@body body: UnprocessableEntityBody;
|
|
76
|
-
}
|