Skip to content

Conversation

@mlewando
Copy link

@mlewando mlewando commented Nov 6, 2025

I noted that the return type of getSchemaType is not correct. It looks to be derived from

export const SCHEMA_TYPES = ["string", "number", "integer", "boolean", "null", "array", "object"]

but the actual declaration was

export function getSchemaType(node: SchemaNode, data: unknown): keyof typeof SCHEMA_TYPES | undefined

The keyof typeof SCHEMA_TYPES is actually "length" | "push" | "pop" | "map" ... which is wrong.

I made the SCHEMA_TYPES a const array and created new simple type:

export type SchemaType = (typeof SCHEMA_TYPES)[number];

to fix that issue.

// nothing found yet check dynamic properties for a type
if (node.if) {
return getSchemaType(node.if, data);
return getSchemaType(node.if.getNode("#").node ?? node.if, data);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is out of scope of this merge request. I am wondering, why are you adding ref-resolution here?

If we were to add this:

  • getNode would need data as second argument to fully use its api
  • I would prefer to use node.if.resolveRef here to be explicit

@sagold
Copy link
Owner

sagold commented Nov 10, 2025

Hey there, thank you for your merge request. Highly appreciated!

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

Successfully merging this pull request may close these issues.

2 participants