Repository navigation
[json_syntax_generator] Support String regex patterns - #2441
Merged
Merged
Conversation
PR HealthAPI leaks ✔️The following packages contain symbols visible in the public API, but not exported by the library. Export these symbols or remove them from your publicly visible API.
License Headers ✔️
All source files should start with a license header. Unrelated files missing license headers
|
dcharkes
force-pushed
the
json-syntax-regex
branch
from
July 23, 2025 14:34
7727052 to
539e614
Compare
dcharkes
marked this pull request as ready for review
July 23, 2025 14:35
goderbauer
approved these changes
Jul 24, 2025
| "properties": { | ||
| "name": { | ||
| "type": "string", | ||
| "pattern": "^[a-zA-Z_]\\w*$", |
Contributor
There was a problem hiding this comment.
uber-nit: for consistency with the rest move this after the description key?
Collaborator
Author
There was a problem hiding this comment.
Ah, let me add the jsons in this package to pkgs/hooks/tool/normalize.dart then they will also be consistent everywhere! (We should probably move that normalizer to the toplevel tools/ directory instead of inside a package.)
| "properties": { | ||
| "name": { | ||
| "type": "string", | ||
| "pattern": "^[a-zA-Z_]\\w*$", |
Contributor
There was a problem hiding this comment.
I am in favor of deleting this since pkg:pub_formats seems to be validating the same thing?
auto-submit Bot
pushed a commit
that referenced
this pull request
Jul 24, 2025
Follow up of #2441. This time adding support for regexes on the strings that are the keys of maps. In order to avoid duplicating: https://github.com/dart-lang/pub/blob/c3e50919d11896f014cb971e1776d00a0e2d18b3/lib/src/pubspec_parse.dart#L219-L226 Again, tested on the pubspec lock schema.
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.
For dart-lang/sdk#60889, I'd like to avoid copy pasting the following code from pub to
dartdevhttps://github.com/dart-lang/pub/blob/c3e50919d11896f014cb971e1776d00a0e2d18b3/lib/src/pubspec_parse.dart#L228-L240
So Instead, I want to make a schema for the pubspec.yaml with
json_syntax_generator.Since users might only use
dart installto interact with theexecutablessection in the pubspec, we need to make sure our validation is identical to what pub does. This means we need support for regex patterns on strings.This PR adds support for regex patterns on strings.
The logic is tested by applying it to the pubspec lock which has some places which have regex patterns (package names, hashes, semantic versions.)
Note we have the pubspec lock schema now twice in the repo. The pub formats package already serves as a test, so deleting the test from the syntax generator package.