Skip to content

Commit 7f58d51

Browse files
committed
fix(request): allow omitting attributes schema
1 parent 2a6b70c commit 7f58d51

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/request.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ type ParseDataRequestOptions<
150150
TRelationshipsSchema extends z.SomeZodObject | undefined,
151151
> = {
152152
type: TType;
153-
attributesSchema: TAttributesSchema;
153+
attributesSchema?: TAttributesSchema;
154154
relationshipsSchema?: TRelationshipsSchema;
155155
};
156156

@@ -214,7 +214,7 @@ const validateContentType = (context: Context): void => {
214214
const parseDataRequest = <
215215
TIdSchema extends z.ZodType<unknown>,
216216
TType extends string,
217-
TAttributesSchema extends z.SomeZodObject,
217+
TAttributesSchema extends z.SomeZodObject | undefined,
218218
TRelationshipsSchema extends z.SomeZodObject | undefined,
219219
>(
220220
idSchema: TIdSchema,
@@ -276,7 +276,7 @@ export type ParseCreateRequestResult<
276276

277277
export const parseCreateRequest = <
278278
TType extends string,
279-
TAttributesSchema extends z.SomeZodObject,
279+
TAttributesSchema extends z.SomeZodObject | undefined,
280280
TRelationshipsSchema extends z.SomeZodObject | undefined,
281281
>(
282282
koaContext: Context,
@@ -287,14 +287,14 @@ export const parseCreateRequest = <
287287

288288
export type ParseUpdateRequestOptions<
289289
TType extends string,
290-
TAttributesSchema extends z.SomeZodObject,
290+
TAttributesSchema extends z.SomeZodObject | undefined,
291291
TRelationshipsSchema extends z.SomeZodObject | undefined,
292292
> = ParseDataRequestOptions<TType, TAttributesSchema, TRelationshipsSchema>;
293293

294294
export type ParseUpdateRequestResult<
295295
TId extends string,
296296
TType extends string,
297-
TAttributesSchema extends z.SomeZodObject,
297+
TAttributesSchema extends z.SomeZodObject | undefined,
298298
TRelationshipsSchema extends z.SomeZodObject | undefined,
299299
> = ParseDataRequestResult<z.ZodType<TId>, TType, TAttributesSchema, TRelationshipsSchema> & {
300300
id: TId;
@@ -303,7 +303,7 @@ export type ParseUpdateRequestResult<
303303
export const parseUpdateRequest = <
304304
TId extends string,
305305
TType extends string,
306-
TAttributesSchema extends z.SomeZodObject,
306+
TAttributesSchema extends z.SomeZodObject | undefined,
307307
TRelationshipsSchema extends z.SomeZodObject | undefined,
308308
>(
309309
id: TId,

0 commit comments

Comments
 (0)