The Open Source DocuSign Alternative.
TypeScript digital-signaturedocument-signingdocusign-alternativee-signatureesignesignaturenext-authnextjsopen-sourcepades-standardpdfpdf-signpdf-signaturepostgresqlprismaself-hostedsigningtypescript
fix: simplify openapi field schemas to fix SDK generation (#2503)
Lucas Smith9a66d0ebf611
diff --git a/packages/trpc/server/envelope-router/envelope-fields/create-envelope-fields.types.ts b/packages/trpc/server/envelope-router/envelope-fields/create-envelope-fields.types.tsindex f1f4e9caa..c87628c35 100644--- a/packages/trpc/server/envelope-router/envelope-fields/create-envelope-fields.types.ts+++ b/packages/trpc/server/envelope-router/envelope-fields/create-envelope-fields.types.ts@@ -37,7 +37,7 @@ const ZCreateFieldBaseSchema = ZEnvelopeFieldAndMetaSchema.and(/*** Position a field using explicit percentage-based coordinates.*/-const ZCoordinatePositionSchema = z.object({+export const ZCoordinatePositionSchema = z.object({page: ZFieldPageNumberSchema,positionX: ZClampedFieldPositionXSchema,positionY: ZClampedFieldPositionYSchema,@@ -52,7 +52,7 @@ const ZCoordinatePositionSchema = z.object({* placed at the bounding box of that match. Width and height can optionally be* overridden; when omitted the dimensions of the placeholder text are used.*/-const ZPlaceholderPositionSchema = z.object({+export const ZPlaceholderPositionSchema = z.object({placeholder: z.string().describe(@@ -72,9 +72,10 @@ const ZPlaceholderPositionSchema = z.object({),});-const ZCreateFieldSchema = ZCreateFieldBaseSchema.and(- z.union([ZCoordinatePositionSchema, ZPlaceholderPositionSchema]),-);+const ZCreateFieldSchema = z.union([+ ZCreateFieldBaseSchema.and(ZCoordinatePositionSchema),+ ZCreateFieldBaseSchema.and(ZPlaceholderPositionSchema),+]);export const ZCreateEnvelopeFieldsRequestSchema = z.object({envelopeId: z.string(),diff --git a/packages/trpc/server/envelope-router/envelope-fields/update-envelope-fields.types.ts b/packages/trpc/server/envelope-router/envelope-fields/update-envelope-fields.types.tsindex 8dd96394d..9130f28e5 100644--- a/packages/trpc/server/envelope-router/envelope-fields/update-envelope-fields.types.ts+++ b/packages/trpc/server/envelope-router/envelope-fields/update-envelope-fields.types.ts@@ -1,16 +1,10 @@import { z } from 'zod';-import {- ZClampedFieldHeightSchema,- ZClampedFieldPositionXSchema,- ZClampedFieldPositionYSchema,- ZClampedFieldWidthSchema,- ZFieldPageNumberSchema,- ZFieldSchema,-} from '@documenso/lib/types/field';+import { ZFieldSchema } from '@documenso/lib/types/field';import { ZEnvelopeFieldAndMetaSchema } from '@documenso/lib/types/field-meta';import type { TrpcRouteMeta } from '../../trpc';+import { ZCoordinatePositionSchema } from './create-envelope-fields.types';export const updateEnvelopeFieldsMeta: TrpcRouteMeta = {openapi: {@@ -22,7 +16,7 @@ export const updateEnvelopeFieldsMeta: TrpcRouteMeta = {},};-const ZUpdateFieldSchema = ZEnvelopeFieldAndMetaSchema.and(+const ZUpdateFieldBaseSchema = ZEnvelopeFieldAndMetaSchema.and(z.object({id: z.number().describe('The ID of the field to update.'),envelopeItemId: z@@ -31,14 +25,18 @@ const ZUpdateFieldSchema = ZEnvelopeFieldAndMetaSchema.and(.describe('The ID of the envelope item to put the field on. If not provided, field will be placed on the first item.',),- page: ZFieldPageNumberSchema.optional(),- positionX: ZClampedFieldPositionXSchema.optional(),- positionY: ZClampedFieldPositionYSchema.optional(),- width: ZClampedFieldWidthSchema.optional(),- height: ZClampedFieldHeightSchema.optional(),}),);+// !: Later on we should support placeholders for updates, but since we didn't do the+// !: neccesary plumbing for updates in the initial release, we can hold off for now.+// const ZUpdateFieldSchema = z.union([+// ZUpdateFieldBaseSchema.and(ZCoordinatePositionSchema),+// ZUpdateFieldBaseSchema.and(ZPlaceholderPositionSchema),+// ]);++const ZUpdateFieldSchema = ZUpdateFieldBaseSchema.and(ZCoordinatePositionSchema.partial());+export const ZUpdateEnvelopeFieldsRequestSchema = z.object({envelopeId: z.string(),data: ZUpdateFieldSchema.array(),