@@ -4,6 +4,7 @@ import { availableGuildPlugins } from "../plugins/availablePlugins.js";
44import { ZeppelinGuildPluginInfo } from "../types.js" ;
55import { indentLines } from "../utils.js" ;
66import { notFound } from "./responses.js" ;
7+ import { $ZodPipeDef } from "zod/v4/core" ;
78
89function isZodObject ( schema : z . ZodType ) : schema is z . ZodObject < any > {
910 return schema . def . type === "object" ;
@@ -45,7 +46,7 @@ function formatZodConfigSchema(schema: z.ZodType) {
4546 if ( isZodObject ( schema ) ) {
4647 return (
4748 `{\n` +
48- Object . entries ( schema . _def . shape ( ) )
49+ Object . entries ( schema . def . shape )
4950 . map ( ( [ k , value ] ) => indentLines ( `${ k } : ${ formatZodConfigSchema ( value as z . ZodType ) } ` , 2 ) )
5051 . join ( "\n" ) +
5152 "\n}"
@@ -61,7 +62,7 @@ function formatZodConfigSchema(schema: z.ZodType) {
6162 return `Array<${ formatZodConfigSchema ( schema . def . element ) } >` ;
6263 }
6364 if ( isZodUnion ( schema ) ) {
64- return schema . _def . options . map ( ( t ) => formatZodConfigSchema ( t ) ) . join ( " | " ) ;
65+ return schema . def . options . map ( ( t ) => formatZodConfigSchema ( t ) ) . join ( " | " ) ;
6566 }
6667 if ( isZodNullable ( schema ) ) {
6768 return `Nullable<${ formatZodConfigSchema ( schema . def . innerType ) } >` ;
@@ -90,6 +91,9 @@ function formatZodConfigSchema(schema: z.ZodType) {
9091 if ( schema . def . type === "never" ) {
9192 return "never" ;
9293 }
94+ if ( schema . def . type === "pipe" ) {
95+ return formatZodConfigSchema ( ( schema . def as $ZodPipeDef ) . in as z . ZodType ) ;
96+ }
9397 return "unknown" ;
9498}
9599
@@ -123,12 +127,7 @@ export function initDocs(router: express.Router) {
123127 }
124128
125129 const { configSchema, ...info } = pluginInfo . docs ;
126- let formattedConfigSchema : string ;
127- try {
128- formattedConfigSchema = JSON . stringify ( z . toJSONSchema ( configSchema ) , null , 2 ) ;
129- } catch ( err ) {
130- formattedConfigSchema = "" ;
131- }
130+ const formattedConfigSchema = formatZodConfigSchema ( configSchema ) ;
132131
133132 const messageCommands = ( pluginInfo . plugin . messageCommands || [ ] ) . map ( ( cmd ) => ( {
134133 trigger : cmd . trigger ,
0 commit comments