Skip to content

fix(worma): guard getParserSchemaType against undefined schema#168

Open
SAY-5 wants to merge 1 commit into
alovajs:mainfrom
SAY-5:fix-array-items-undefined-parser-crash
Open

fix(worma): guard getParserSchemaType against undefined schema#168
SAY-5 wants to merge 1 commit into
alovajs:mainfrom
SAY-5:fix-array-items-undefined-parser-crash

Conversation

@SAY-5

@SAY-5 SAY-5 commented Jul 17, 2026

Copy link
Copy Markdown

Closes #830.

An array schema with no items makes arrayTypeParser call ctx.next(undefined, ...), so getParserSchemaType receives undefined and throws Cannot read properties of undefined (reading 'type') at parsers/utils.ts when it reaches schema.type.

Return 'null' early when the schema is nullish, matching the existing fallback for typeless schemas, so alova gen no longer crashes on such documents. Added a unit test in test/parsers/utils.spec.ts covering the undefined case.

Signed-off-by: Sai Asish Y <say.apm35@gmail.com>
@changeset-bot

changeset-bot Bot commented Jul 17, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 25c8748

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions github-actions Bot added the worma label Jul 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant