Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"schema" property causes bad merge when using page API on nolita serve #121

Open
matildepark opened this issue Aug 6, 2024 · 1 comment

Comments

@matildepark
Copy link
Contributor

Page API schema examples at, eg. localhost:3000 when using npx nolita serve, include this in the request body:

{ schema: "string" }

but this will create this error, presumably because it’s not a zod object, just an incoming string:

TypeError: merging._def.shape is not a function
    at Object.shape (/root/.npm/_npx/bb86540f6c337315/node_modules/nolita/node_modules/zod/lib/types.js:2003:33)
    at parseObjectDef (/root/.npm/_npx/bb86540f6c337315/node_modules/nolita/node_modules/zod-to-json-schema/dist/cjs/parsers/object.js:80:31)
    at selectParser (/root/.npm/_npx/bb86540f6c337315/node_modules/nolita/node_modules/zod-to-json-schema/dist/cjs/parseDef.js:92:51)
    at parseDef (/root/.npm/_npx/bb86540f6c337315/node_modules/nolita/node_modules/zod-to-json-schema/dist/cjs/parseDef.js:52:24)
    at parseOptionalDef (/root/.npm/_npx/bb86540f6c337315/node_modules/nolita/node_modules/zod-to-json-schema/dist/cjs/parsers/optional.js:7:43)
    at selectParser (/root/.npm/_npx/bb86540f6c337315/node_modules/nolita/node_modules/zod-to-json-schema/dist/cjs/parseDef.js:123:55)
    at parseDef (/root/.npm/_npx/bb86540f6c337315/node_modules/nolita/node_modules/zod-to-json-schema/dist/cjs/parseDef.js:52:24)
    at Object.entries.reduce.properties (/root/.npm/_npx/bb86540f6c337315/node_modules/nolita/node_modules/zod-to-json-schema/dist/cjs/parsers/object.js:83:58)
    at Array.reduce (<anonymous>)
    at parseObjectDef (/root/.npm/_npx/bb86540f6c337315/node_modules/nolita/node_modules/zod-to-json-schema/dist/cjs/parsers/object.js:80:40

Removing the schema field from submission in /step, /browse etc fixes this.

@matildepark
Copy link
Contributor Author

@AlephNotation is there a different example we should be using in the schema besides "schema": "string",? Or is string what it's supposed to use?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant