Repository navigation
Conversation
pattern metadata was already serialized as the pattern keyword of generated JSON Schema at runtime, but .configure() rejected it at compile-time since it was missing from NodeMeta. Add it to NodeMeta so it is accepted everywhere TypeMeta is, including .configure(), the tuple "@" syntax and scope keywords configs.
- condense JSDoc for NodeMeta.pattern
- align test with repo conventions: bare issue-link comment,
attest type.errors("") idiom for asserting no type errors
pattern in configure (fixes #1469)
This branch has not been deployed
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.
Fixes #1469
What
Users could pass
patternto.configure(...)and it was silently serialized into the generated JSON Schema, but the compiler rejected it sincepatternwas not part of the ambient meta type:Why
patternis already copied verbatim from meta to the output schema byBaseRoot.toResolvedJsonSchema(meta keys that are valid JSON are spread onto the result), so the fix is purely type-level: addpattern?: stringtoNodeMetainark/schema/shared/declare.ts, from whichArkEnv.metaandTypeMetaare derived.A JSDoc note documents the important gotcha that meta
patterndoes not affect validation— for that, use a regex definition liketype("/^$/").Tests
ark/type/__tests__/toJsonSchema.test.ts: assertspatternis accepted by.configure(no type errors viaattest(...).type.errors) and preserved bytoJsonSchema()output.Checks
main(rebased on326cdce)pnpm prCheckspasses locally (lint, build, typecheck, tests, benches — all instantiation benchmarks at 0.00% delta — as well astestTypedLoose,testTsCompatandtestTsVersions)