JSON schema supports @x-plugin null comment.#1717
Merged
Conversation
commit: |
Contributor
There was a problem hiding this comment.
Pull request overview
Updates JSON schema jsDoc tag handling so extension tags can cast the literal string "null" into the JSON null value, and adds a regression test for the behavior.
Changes:
- Trim jsDoc tag text values before casting and add
"null"→nullcasting forx-*tags. - Add a test asserting
@x-null-value nullis emitted asnullin the generated schema. - Bump package version from
11.0.1to11.0.2.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/programmers/internal/json_schema_jsDocTags.ts |
Trims jsDoc tag text and extends casting logic to support null. |
test/src/features/issues/test_pr_1714_json_schema_plugin_by_jsDocTags.ts |
Adds coverage for @x-null-value null producing null in schema output. |
package.json |
Version bump to reflect the change. |
test/src/features/issues/test_pr_1714_json_schema_plugin_by_jsDocTags.ts
Show resolved
Hide resolved
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request updates the handling of jsDoc tags in the JSON schema plugin to support proper casting of the string
"null"to the JavaScriptnullvalue. It also adds corresponding tests to ensure this behavior is correctly validated.Enhancements to jsDoc tag value casting:
castfunction insrc/programmers/internal/json_schema_jsDocTags.tsto convert the string"null"to the JavaScriptnullvalue, in addition to existing conversions for booleans and numbers.Testing improvements:
test/src/features/issues/test_pr_1714_json_schema_plugin_by_jsDocTags.tsto verify that the new@x-null-value nulljsDoc tag is correctly cast tonullin the generated schema.ISomethinginterface in the same test file to include the@x-null-value nulljsDoc tag for theidproperty.Version update:
package.jsonfrom11.0.1to11.0.2to reflect these changes.