@@ -2,22 +2,20 @@ import { Tenancy } from "@/lib/tenancies";
22import { createCrudHandlers } from "@/route-handlers/crud-handler" ;
33import { CrudTypeOf , createCrud } from "@stackframe/stack-shared/dist/crud" ;
44import * as schemaFields from "@stackframe/stack-shared/dist/schema-fields" ;
5- import { yupMixed , yupObject } from "@stackframe/stack-shared/dist/schema-fields" ;
5+ import { yupMixed , yupObject , yupString } from "@stackframe/stack-shared/dist/schema-fields" ;
66import { StatusError , throwErr } from "@stackframe/stack-shared/dist/utils/errors" ;
77import { createLazyProxy } from "@stackframe/stack-shared/dist/utils/proxies" ;
88import { stringCompare } from "@stackframe/stack-shared/dist/utils/strings" ;
99import { projectsCrudHandlers } from "../../../internal/projects/current/crud" ;
1010
11- const domainSchema = schemaFields . wildcardProtocolAndDomainSchema . max ( 300 ) . defined ( )
12- . matches ( / ^ h t t p s ? : \/ \/ / , 'URL must start with http:// or https://' )
13- . meta ( { openapiField : { description : 'URL. Must start with http:// or https://' , exampleValue : 'https://example.com' } } ) ;
14-
1511const domainReadSchema = yupObject ( {
16- domain : domainSchema . defined ( ) ,
12+ domain : yupString ( ) . defined ( ) ,
1713} ) ;
1814
1915const domainCreateSchema = yupObject ( {
20- domain : domainSchema . defined ( ) ,
16+ domain : schemaFields . wildcardProtocolAndDomainSchema . max ( 300 ) . defined ( )
17+ . matches ( / ^ h t t p s ? : \/ \/ / , 'URL must start with http:// or https://' )
18+ . meta ( { openapiField : { description : 'URL. Must start with http:// or https://' , exampleValue : 'https://example.com' } } ) ,
2119} ) ;
2220
2321export const domainDeleteSchema = yupMixed ( ) ;
@@ -53,7 +51,7 @@ function domainConfigToLegacyConfig(domain: Tenancy['config']['domains']['truste
5351
5452export const domainCrudHandlers = createLazyProxy ( ( ) => createCrudHandlers ( domainCrud , {
5553 paramsSchema : yupObject ( {
56- domain : domainSchema . optional ( ) ,
54+ domain : yupString ( ) . optional ( ) ,
5755 } ) ,
5856 onCreate : async ( { auth, data, params } ) => {
5957 const oldDomains = auth . tenancy . config . domains . trustedDomains ;
0 commit comments