Repository navigation
Conversation
JSONC adds `//` and `/* */` comments and trailing commas to JSON. `.jsonc` files with comments, such as the `// Invalid:` examples written by the gts-spec example generator, were silently skipped because they were parsed as strict JSON. - Add `gts::jsonc`: `strip` blanks comments, trailing commas and a leading UTF-8 BOM in place, keeping byte offsets and line breaks so `serde_json` errors point at the original line and column. No new dependencies. - Parse `*.jsonc` as JSONC in `GtsFileReader`, `gts validate-json` (which now also discovers `.jsonc` files) and `gts-validator`; `*.json` stays strict. - Accept `--config <file>.jsonc` and a default `gts.config.jsonc`; `gts.config.json` wins if both exist. Unreadable or malformed config files are now reported with a warning instead of being ignored silently. - REST server: accept `Content-Type: application/jsonc` bodies on every endpoint. A middleware strips them and forwards `application/json`, so the handlers, the effective `DefaultBodyLimit` and the 400/413/422 rejections are the same as for JSON. `application/json` stays strict. Signed-off-by: Artifizer <artifizer@gmail.com>
The tracing subscriber wrote to stdout, so any warning was mixed into the JSON results the CLI prints there and broke piping into tools such as `jq`. Server `-v`/`-vv` logs move to stderr as well; the request/response logging middleware already used stderr. Signed-off-by: Artifizer <artifizer@gmail.com>
Signed-off-by: Artifizer <artifizer@gmail.com>
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
JSONC parsing and file reading gts/src/jsonc.rs, gts/src/lib.rs, gts/src/files_reader.rs |
A public parser strips comments, trailing commas, and a leading BOM while preserving offsets and line breaks. File reading uses the path extension to choose JSONC or strict JSON parsing. |
Configuration file loading gts/src/ops.rs, README.md |
Configuration loading checks an explicit path first, then gts.config.json and gts.config.jsonc. Tests cover precedence and fallback. The README documents JSONC configuration files. |
CLI JSON and JSONC validation gts-cli/src/json_validation.rs, gts-cli/src/cli.rs, README.md |
The CLI discovers and parses JSON and JSONC files. Tests cover single-file and directory validation. The README adds JSONC input references. |
Filesystem validator JSONC scanning gts-validator/src/strategy/*, gts-validator/src/format/mod.rs, gts-validator/src/lib.rs, gts-validator/src/main.rs, gts-validator/tests/validate_fs_tests.rs, gts-validator/README.md |
The validator discovers JSONC files and strips JSONC before scanning. Tests cover valid and invalid identifiers and confirm that JSONC syntax under a .json extension fails. |
JSONC HTTP request bodies gts-cli/src/server.rs, gts-cli/tests/server_tests.rs, README.md |
Router middleware recognizes application/jsonc, strips JSONC text, and forwards the body as application/json. Tests cover endpoint behavior, media types, malformed input, encoding, and body limits. |
Crate version updates
| Layer / File(s) | Summary |
|---|---|
Workspace and package versions Cargo.toml, gts*/Cargo.toml |
Workspace dependency constraints and package versions change from 0.16.2 to 0.16.3. |
CLI tracing output
| Layer / File(s) | Summary |
|---|---|
Tracing output destination gts-cli/src/cli.rs |
The CLI tracing subscriber writes output to stderr. |
Priority:
Estimated code review effort: 4 (Complex) | ~45 minutes
Change: Feature
Sequence Diagram(s)
sequenceDiagram
participant Client
participant accept_jsonc_body
participant AxumEndpoint
Client->>accept_jsonc_body: POST with application/jsonc body
accept_jsonc_body->>AxumEndpoint: Forward stripped body as application/json
AxumEndpoint->>Client: Return endpoint response
Possibly related PRs
- GlobalTypeSystem/gts-rust#146: Updates the same workspace and package version declarations from 0.16.1 to 0.16.2.
Suggested reviewers: aviator5, devjow
Merge Risk: 
Minimal · up to 10dd7
-
No identified issue blocks merging; complete the normal checks before release.
Pre-merge checks: 
4 · 
1
-
Failed checks: 1 warning Passed checks: 4 passedFull details: Docstring Coverage
-
Explanation
Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 60 functions across 14 files. (10 skipped: 10 unsupported.)
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
-
Finishing Touches: 💡 1
-
📝 Generate docstrings: 💡
-
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands.
code-ranker View diff report ↗rust
baseline main @45d7ac9 2026-10-23 11:32 UTC · updated 2026-10-25 17:20 UTC |
Summary
Adds JSONC (JSON with
////* */comments and trailing commas) support across the crates. Before this change,.jsoncfiles were discovered, but any comment made them fail to parse and they were silently skipped. That includes the// Invalid:examples the gts-spec example generator writes.gts::jsonc(new public module):stripblanks comments, trailing commas and a leading UTF-8 BOM in place. Byte offsets and line breaks are kept, soserde_jsonerrors point at the original line and column. No new dependencies.*.jsoncis parsed as JSONC byGtsFileReader,gts validate-json(which now also discovers.jsonc) andgts-validator.*.jsonstays strict JSON.--config <file>.jsoncand a defaultgts.config.jsoncare supported;gts.config.jsonwins if both exist. Unreadable or malformed config files now produce a warning instead of being ignored silently.Content-Type: application/jsoncbodies are accepted on every endpoint. A middleware strips them and forwardsapplication/json, so handlers, the effectiveDefaultBodyLimitand the 400/413/422 rejections are the same as for JSON.application/jsonstays strict.fix(gts-cli): CLI logs now go to stderr, so warnings no longer corrupt the JSON results on stdout (gts ... | jq). Server-vlogs move to stderr too;make gts-server/gts-spec-testsalready capture both streams.chore: bump all GTS crates to v0.16.3.gts-validatordepends on the newgts::jsoncmodule.Behavior changes to be aware of
gts --path <dir>now loads entities from.jsoncfiles with comments. For example, pointing it atgts-test-examples/registers theinvalid/*.jsoncexamples, which were previously skipped.gts-validatornow scans.jsoncfiles, which may surface new findings in CI..jsoncas strict JSON; they will be aligned separately.Test plan
cargo fmt --all -- --check,cargo clippy --workspace --all-targets --all-features -D warningscargo test --workspace. New tests cover the stripper (comments, trailing commas, BOM, strings containing comment markers, malformed input, error positions),.jsoncloading in the file reader /validate-json/gts-validator, config precedence and fallback, and the REST server (JSONC bodies, media-type parameters and case, strictapplication/json, 400/413/422 parity, outerDefaultBodyLimit, non-UTF-8 bodies)gts-test-examples/invalid/types/*.jsoncfiles now parse ingts list,gts validate-jsonandgts-validator(0 parse errors); live server returns 200 for a JSONC file sent asapplication/jsoncand 400 asapplication/jsonmake gts-spec-tests(needs Docker; not run locally)make dylint(not run locally)Summary by CodeRabbit
application/jsonc.gts.config.jsonc, alongsidegts.config.json.