Skip to content

Commit

Permalink
fix(request): allow omitting attributes schema
Browse files Browse the repository at this point in the history
  • Loading branch information
DASPRiD committed Mar 20, 2024
1 parent 2a6b70c commit 7f58d51
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ type ParseDataRequestOptions<
TRelationshipsSchema extends z.SomeZodObject | undefined,
> = {
type: TType;
attributesSchema: TAttributesSchema;
attributesSchema?: TAttributesSchema;
relationshipsSchema?: TRelationshipsSchema;
};

Expand Down Expand Up @@ -214,7 +214,7 @@ const validateContentType = (context: Context): void => {
const parseDataRequest = <
TIdSchema extends z.ZodType<unknown>,
TType extends string,
TAttributesSchema extends z.SomeZodObject,
TAttributesSchema extends z.SomeZodObject | undefined,
TRelationshipsSchema extends z.SomeZodObject | undefined,
>(
idSchema: TIdSchema,
Expand Down Expand Up @@ -276,7 +276,7 @@ export type ParseCreateRequestResult<

export const parseCreateRequest = <
TType extends string,
TAttributesSchema extends z.SomeZodObject,
TAttributesSchema extends z.SomeZodObject | undefined,
TRelationshipsSchema extends z.SomeZodObject | undefined,
>(
koaContext: Context,
Expand All @@ -287,14 +287,14 @@ export const parseCreateRequest = <

export type ParseUpdateRequestOptions<
TType extends string,
TAttributesSchema extends z.SomeZodObject,
TAttributesSchema extends z.SomeZodObject | undefined,
TRelationshipsSchema extends z.SomeZodObject | undefined,
> = ParseDataRequestOptions<TType, TAttributesSchema, TRelationshipsSchema>;

export type ParseUpdateRequestResult<
TId extends string,
TType extends string,
TAttributesSchema extends z.SomeZodObject,
TAttributesSchema extends z.SomeZodObject | undefined,
TRelationshipsSchema extends z.SomeZodObject | undefined,
> = ParseDataRequestResult<z.ZodType<TId>, TType, TAttributesSchema, TRelationshipsSchema> & {
id: TId;
Expand All @@ -303,7 +303,7 @@ export type ParseUpdateRequestResult<
export const parseUpdateRequest = <
TId extends string,
TType extends string,
TAttributesSchema extends z.SomeZodObject,
TAttributesSchema extends z.SomeZodObject | undefined,
TRelationshipsSchema extends z.SomeZodObject | undefined,
>(
id: TId,
Expand Down

0 comments on commit 7f58d51

Please sign in to comment.