@@ -61,6 +61,7 @@ export function getCorrectJsonSchema<T, U>({
61
61
export const notAuthenticatedError = getCorrectJsonSchema ( {
62
62
schema : z
63
63
. object ( {
64
+ error : z . literal ( true ) ,
64
65
name : z . literal ( "UnauthenticatedError" ) ,
65
66
id : z . literal ( 102 ) ,
66
67
message : z . string ( ) . min ( 1 ) ,
@@ -70,6 +71,7 @@ export const notAuthenticatedError = getCorrectJsonSchema({
70
71
} ) ,
71
72
description : "The request could not be authenticated." ,
72
73
example : {
74
+ error : true ,
73
75
name : "UnauthenticatedError" ,
74
76
id : 102 ,
75
77
message : "Token not found." ,
@@ -79,6 +81,7 @@ export const notAuthenticatedError = getCorrectJsonSchema({
79
81
export const notFoundError = getCorrectJsonSchema ( {
80
82
schema : z
81
83
. object ( {
84
+ error : z . literal ( true ) ,
82
85
name : z . literal ( "NotFoundError" ) ,
83
86
id : z . literal ( 103 ) ,
84
87
message : z . string ( ) . min ( 1 ) ,
@@ -88,6 +91,7 @@ export const notFoundError = getCorrectJsonSchema({
88
91
} ) ,
89
92
description : "The resource could not be found." ,
90
93
example : {
94
+ error : true ,
91
95
name : "NotFoundError" ,
92
96
id : 103 ,
93
97
message : "{url} is not a valid URL." ,
@@ -97,6 +101,7 @@ export const notFoundError = getCorrectJsonSchema({
97
101
export const notAuthorizedError = getCorrectJsonSchema ( {
98
102
schema : z
99
103
. object ( {
104
+ error : z . literal ( true ) ,
100
105
name : z . literal ( "UnauthorizedError" ) ,
101
106
id : z . literal ( 101 ) ,
102
107
message : z . string ( ) . min ( 1 ) ,
@@ -107,6 +112,7 @@ export const notAuthorizedError = getCorrectJsonSchema({
107
112
description :
108
113
"The caller does not have the appropriate permissions for this task." ,
109
114
example : {
115
+ error : true ,
110
116
name : "UnauthorizedError" ,
111
117
id : 101 ,
112
118
message : "User does not have the privileges for this task." ,
@@ -119,6 +125,7 @@ export const internalServerError = getCorrectJsonSchema({
119
125
"application/json" : {
120
126
schema : z
121
127
. object ( {
128
+ error : z . literal ( true ) ,
122
129
name : z . literal ( "InternalServerError" ) ,
123
130
id : z . literal ( 100 ) ,
124
131
message : z . string ( ) . min ( 1 ) ,
@@ -133,6 +140,7 @@ export const internalServerError = getCorrectJsonSchema({
133
140
} ,
134
141
description : "The server encountered an error processing the request." ,
135
142
example : {
143
+ error : true ,
136
144
name : "InternalServerError" ,
137
145
id : 100 ,
138
146
message :
@@ -143,6 +151,7 @@ export const internalServerError = getCorrectJsonSchema({
143
151
export const rateLimitExceededError = getCorrectJsonSchema ( {
144
152
schema : z
145
153
. object ( {
154
+ error : z . literal ( true ) ,
146
155
name : z . literal ( "RateLimitExceededError" ) ,
147
156
id : z . literal ( 409 ) ,
148
157
message : z . literal ( "Rate limit exceeded." ) ,
@@ -153,6 +162,7 @@ export const rateLimitExceededError = getCorrectJsonSchema({
153
162
} ) ,
154
163
description : "The caller has sent too many requests. Try again later." ,
155
164
example : {
165
+ error : true ,
156
166
name : "RateLimitExceededError" ,
157
167
id : 409 ,
158
168
message : "Rate limit exceeded." ,
@@ -162,16 +172,18 @@ export const rateLimitExceededError = getCorrectJsonSchema({
162
172
export const validationError = getCorrectJsonSchema ( {
163
173
schema : z
164
174
. object ( {
165
- name : z . literal ( "RateLimitExceededError" ) ,
166
- id : z . literal ( 104 ) ,
167
- message : z . literal ( "Rate limit exceeded." ) ,
175
+ error : z . literal ( true ) ,
176
+ name : z . string ( ) . min ( 1 ) ,
177
+ id : z . number ( ) ,
178
+ message : z . string ( ) . min ( 1 ) ,
168
179
} )
169
180
. meta ( {
170
181
id : "validationError" ,
171
182
description : "The request is invalid." ,
172
183
} ) ,
173
184
description : "The request is invalid." ,
174
185
example : {
186
+ error : true ,
175
187
name : "ValidationError" ,
176
188
id : 104 ,
177
189
message : "Request is invalid." ,
0 commit comments