Skip to content

add isJsonSchema and isBooleanSchema typeguards, update public method#102

Merged
sagold merged 3 commits intosagold:mainfrom
Adityakumar37:fixes#93
Mar 1, 2026
Merged

add isJsonSchema and isBooleanSchema typeguards, update public method#102
sagold merged 3 commits intosagold:mainfrom
Adityakumar37:fixes#93

Conversation

@Adityakumar37
Copy link
Contributor

@Adityakumar37 Adityakumar37 commented Feb 22, 2026

@sagold,
Added isJsonSchema and isBooleanSchema typeguards in types.ts
Updated compileSchema and addRemoteSchema signatures to accept JsonSchema | BooleanSchema
Added isJsonSchema guard in addRemoteSchema implementation
SchemaNode.schema left unchanged for now (follow-up PR)

@sagold
Copy link
Owner

sagold commented Feb 22, 2026

Hi Aditya,

thank you for the PR! Two things that should be added to the PR to be complete:

  • the main index.ts exports all functions and utilities that might make be useful to a consumer. Both type guards should be exported, too.
  • Since we now officially support a boolean schema as input for compileSchema and addRemoteSchema we should add some unit tests to see if they are supported when executing the methods and probably check all other methods that they can work with a boolean-schema. Mainly getData, getNode, getRootNode. Other methods might required. validate is already been tested by the json-schema-test-suite.

Let me know if you have any questions.

@Adityakumar37
Copy link
Contributor Author

Hi @sagold,
I've pushed the updated commits. Here's what was added:
Exported isJsonSchema and isBooleanSchema from index.ts
Added unit tests for compileSchema, getNode, getData, addRemoteSchema and getNodeRoot with boolean schemas

All 904 unit tests passing. Let me know if anything else is needed

@sagold
Copy link
Owner

sagold commented Feb 24, 2026

Hi Aditya,

thank you so much. I just have one last question:

does this work with compileSchema(boolean)

and can we have a test for this? The type explicitly states that this should work.

@Adityakumar37
Copy link
Contributor Author

Hi @sagold,

Pushed the latest updates:

compileSchema(false) and compileSchema(true) now work as root boolean schemas
Added tests for getNode, getData and validate with boolean schemas
All 910 unit tests passing, lint clean

Let me know if anything else is needed!

@sagold
Copy link
Owner

sagold commented Mar 1, 2026

Will merge your PR and publish it after some tests.

Thank you for your contribution!

@sagold sagold merged commit 059c9a0 into sagold:main Mar 1, 2026
7 checks passed
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