Skip to content

refactor!: separate schema declarations from output paths - #149

Open
aviator5 wants to merge 2 commits into
GlobalTypeSystem:mainfrom
aviator5:refactor/148-schema-output-paths
Open

aviator5 wants to merge 2 commits into
GlobalTypeSystem:mainfrom
aviator5:refactor/148-schema-output-paths

Conversation

@aviator5

@aviator5 aviator5 commented Nov 9, 2026

Copy link
Copy Markdown
Member

Remove filesystem configuration from struct_to_gts_schema and let the CLI write schemas directly to --output DIR (default ./schemas from cwd). Parse Rust declarations with syn, validate IDs before writes, reject conflicting schemas and output-file symlinks, and migrate examples, documentation, macro fixtures, and Dylint snapshots together.

BREAKING CHANGE: dir_path and GTS_SCHEMA_FILE_PATH are removed. Pass the output directory to gts generate-from-rust --output DIR instead.

Fixes #148

Remove filesystem configuration from struct_to_gts_schema and let the CLI
write schemas directly to --output DIR (default ./schemas from cwd).
Parse Rust declarations with syn, validate IDs before writes, reject
conflicting schemas and output-file symlinks, and migrate examples,
documentation, macro fixtures, and Dylint snapshots together.

BREAKING CHANGE: dir_path and GTS_SCHEMA_FILE_PATH are removed. Pass the
output directory to gts generate-from-rust --output DIR instead.

Fixes GlobalTypeSystem#148

Signed-off-by: Aviator 5 <ai.agent.tor@gmail.com>
@coderabbitai

coderabbitai Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Too many files!

This PR contains 154 files, which is 54 over the limit of 100.

To get a review, reduce the PR to 100 files or fewer by splitting it into smaller PRs or changing its base branch.

Upgrade to a paid plan to raise the limit.

This review couldn't start because sufficient usage credits or metered capacity aren't available. Add credits or update usage-based reviews in the billing tab, then retry.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 3eec4741-71dd-484c-a645-4367806a845f
Commits

Reviewing files that changed from the base of the PR and between 4c9c9c3 and 1fc7c37.

Files ignored due to path filters: 1

  • Cargo.lock is excluded by !**/*.lock
Files selected for processing: 154

  • Makefile
  • README.md
  • gts-cli/Cargo.toml
  • gts-cli/src/cargo_main.rs
  • gts-cli/src/cli.rs
  • gts-cli/src/gen_schemas.rs
  • gts-cli/src/gen_schemas/source.rs
  • gts-cli/src/main.rs
  • gts-cli/tests/schema_output_tests.rs
  • gts-dylint/README.md
  • gts-dylint/examples/no_trigger_gts_instance.rs
  • gts-dylint/examples/no_trigger_struct_to_gts_schema.rs
  • gts-dylint/examples/trigger_gts_instance.rs
  • gts-dylint/examples/trigger_gts_instance.stderr
  • gts-dylint/examples/trigger_struct_to_gts_schema.rs
  • gts-dylint/examples/trigger_struct_to_gts_schema.stderr
  • gts-macros-cli/src/main.rs
  • gts-macros/README.md
  • gts-macros/src/lib.rs
  • gts-macros/tests/compile_fail/base_parent_mismatch.rs
  • gts-macros/tests/compile_fail/base_parent_mismatch.stderr
  • gts-macros/tests/compile_fail/base_parent_no_generic.rs
  • gts-macros/tests/compile_fail/base_parent_no_generic.stderr
  • gts-macros/tests/compile_fail/base_parent_single_segment.rs
  • gts-macros/tests/compile_fail/base_parent_single_segment.stderr
  • gts-macros/tests/compile_fail/base_struct_both_id_and_type.rs
  • gts-macros/tests/compile_fail/base_struct_both_id_and_type.stderr
  • gts-macros/tests/compile_fail/base_struct_missing_id.rs
  • gts-macros/tests/compile_fail/base_struct_missing_id.stderr
  • gts-macros/tests/compile_fail/base_struct_wrong_gts_type.rs
  • gts-macros/tests/compile_fail/base_struct_wrong_gts_type.stderr
  • gts-macros/tests/compile_fail/base_struct_wrong_id_type.rs
  • gts-macros/tests/compile_fail/base_struct_wrong_id_type.stderr
  • gts-macros/tests/compile_fail/base_true_multi_segment.rs
  • gts-macros/tests/compile_fail/base_true_multi_segment.stderr
  • gts-macros/tests/compile_fail/both_type_id_and_schema_id.rs
  • gts-macros/tests/compile_fail/both_type_id_and_schema_id.stderr
  • gts-macros/tests/compile_fail/derive_from_final.rs
  • gts-macros/tests/compile_fail/derive_from_final.stderr
  • gts-macros/tests/compile_fail/enum_not_supported.rs
  • gts-macros/tests/compile_fail/enum_not_supported.stderr
  • gts-macros/tests/compile_fail/gts_abstract_final_conflict.rs
  • gts-macros/tests/compile_fail/gts_abstract_final_conflict.stderr
  • gts-macros/tests/compile_fail/instance_chained_carrier_no_turbofish.rs
  • gts-macros/tests/compile_fail/instance_chained_carrier_no_turbofish.stderr
  • gts-macros/tests/compile_fail/instance_derived_target_id_mismatch.rs
  • gts-macros/tests/compile_fail/instance_derived_target_id_mismatch.stderr
  • gts-macros/tests/compile_fail/instance_id_invalid_format.rs
  • gts-macros/tests/compile_fail/instance_id_invalid_format.stderr
  • gts-macros/tests/compile_fail/instance_id_not_literal.rs
  • gts-macros/tests/compile_fail/instance_id_not_literal.stderr
  • gts-macros/tests/compile_fail/instance_id_prefix_mismatch.rs
  • gts-macros/tests/compile_fail/instance_id_prefix_mismatch.stderr
  • gts-macros/tests/compile_fail/instance_id_too_deep.rs
  • gts-macros/tests/compile_fail/instance_id_too_deep.stderr
  • gts-macros/tests/compile_fail/instance_id_wildcard_in_instance.rs
  • gts-macros/tests/compile_fail/instance_id_wildcard_in_instance.stderr
  • gts-macros/tests/compile_fail/instance_missing_id.rs
  • gts-macros/tests/compile_fail/instance_missing_id.stderr
  • gts-macros/tests/compile_fail/instance_of_abstract.rs
  • gts-macros/tests/compile_fail/instance_of_abstract.stderr
  • gts-macros/tests/compile_fail/instance_unknown_attribute.rs
  • gts-macros/tests/compile_fail/instance_unknown_attribute.stderr
  • gts-macros/tests/compile_fail/invalid_file_extension.rs
  • gts-macros/tests/compile_fail/invalid_file_extension.stderr
  • gts-macros/tests/compile_fail/invalid_gts_id_missing_prefix.rs
  • gts-macros/tests/compile_fail/invalid_gts_id_missing_prefix.stderr
  • gts-macros/tests/compile_fail/invalid_gts_id_too_many_tokens.rs
  • gts-macros/tests/compile_fail/invalid_gts_id_too_many_tokens.stderr
  • gts-macros/tests/compile_fail/missing_base.rs
  • gts-macros/tests/compile_fail/missing_base.stderr
  • gts-macros/tests/compile_fail/missing_description.rs
  • gts-macros/tests/compile_fail/missing_description.stderr
  • gts-macros/tests/compile_fail/missing_file_path.stderr
  • gts-macros/tests/compile_fail/missing_properties.rs
  • gts-macros/tests/compile_fail/missing_properties.stderr
  • gts-macros/tests/compile_fail/missing_property.rs
  • gts-macros/tests/compile_fail/missing_property.stderr
  • gts-macros/tests/compile_fail/missing_type_id.rs
  • gts-macros/tests/compile_fail/missing_type_id.stderr
  • gts-macros/tests/compile_fail/multiple_type_generics.rs
  • gts-macros/tests/compile_fail/multiple_type_generics.stderr
  • gts-macros/tests/compile_fail/nested_direct_serialize.rs
  • gts-macros/tests/compile_fail/nested_direct_serialize.stderr
  • gts-macros/tests/compile_fail/nested_direct_serialize_cfg_attr.rs
  • gts-macros/tests/compile_fail/nested_direct_serialize_cfg_attr.stderr
  • gts-macros/tests/compile_fail/non_gts_generic.rs
  • gts-macros/tests/compile_fail/non_gts_generic.stderr
  • gts-macros/tests/compile_fail/removed_dir_path.rs
  • gts-macros/tests/compile_fail/removed_dir_path.stderr
  • gts-macros/tests/compile_fail/removed_file_path_metadata.rs
  • gts-macros/tests/compile_fail/removed_file_path_metadata.stderr
  • gts-macros/tests/compile_fail/traits_inline_not_marked.rs
  • gts-macros/tests/compile_fail/traits_inline_not_marked.stderr
  • gts-macros/tests/compile_fail/traits_no_schema_in_chain.rs
  • gts-macros/tests/compile_fail/traits_no_schema_in_chain.stderr
  • gts-macros/tests/compile_fail/traits_prohibited_by_chain.rs
  • gts-macros/tests/compile_fail/traits_prohibited_by_chain.stderr
  • gts-macros/tests/compile_fail/traits_schema_inline_not_jsonschema.rs
  • gts-macros/tests/compile_fail/traits_schema_inline_not_jsonschema.stderr
  • gts-macros/tests/compile_fail/traits_schema_ref_not_gts_type.rs
  • gts-macros/tests/compile_fail/traits_schema_ref_not_gts_type.stderr
  • gts-macros/tests/compile_fail/traits_schema_string_literal.rs
  • gts-macros/tests/compile_fail/traits_schema_string_literal.stderr
  • gts-macros/tests/compile_fail/traits_schema_under_prohibited.rs
  • gts-macros/tests/compile_fail/traits_schema_under_prohibited.stderr
  • gts-macros/tests/compile_fail/traits_without_schema_on_base.rs
  • gts-macros/tests/compile_fail/traits_without_schema_on_base.stderr
  • gts-macros/tests/compile_fail/tuple_struct.rs
  • gts-macros/tests/compile_fail/tuple_struct.stderr
  • gts-macros/tests/compile_fail/unit_struct.rs
  • gts-macros/tests/compile_fail/unit_struct.stderr
  • gts-macros/tests/compile_fail/unknown_attribute.rs
  • gts-macros/tests/compile_fail/unknown_attribute.stderr
  • gts-macros/tests/compile_fail/version_mismatch_major.rs
  • gts-macros/tests/compile_fail/version_mismatch_major.stderr
  • gts-macros/tests/compile_fail/version_mismatch_minor_missing_schema.rs
  • gts-macros/tests/compile_fail/version_mismatch_minor_missing_schema.stderr
  • gts-macros/tests/compile_fail/version_mismatch_minor_missing_struct.rs
  • gts-macros/tests/compile_fail/version_mismatch_minor_missing_struct.stderr
  • gts-macros/tests/compile_fail/version_missing_both.rs
  • gts-macros/tests/compile_fail/version_missing_both.stderr
  • gts-macros/tests/compile_fail/version_missing_in_schema.rs
  • gts-macros/tests/compile_fail/version_missing_in_schema.stderr
  • gts-macros/tests/compile_fail/version_missing_in_struct.rs
  • gts-macros/tests/compile_fail/version_missing_in_struct.stderr
  • gts-macros/tests/deprecated_schema_id_alias.rs
  • gts-macros/tests/golden/additional_properties_content_models.rs
  • gts-macros/tests/golden/additional_properties_explicit_open.rs
  • gts-macros/tests/golden/additional_properties_flattened_map.rs
  • gts-macros/tests/golden/additional_properties_gts_derived_open.rs
  • gts-macros/tests/golden/additional_properties_gts_root_open.rs
  • gts-macros/tests/golden/additional_properties_nested_closed.rs
  • gts-macros/tests/golden/optional_generic_mid_chain.rs
  • gts-macros/tests/golden/optional_generic_root.rs
  • gts-macros/tests/golden/traits_bool_false.rs
  • gts-macros/tests/golden/traits_bool_true.rs
  • gts-macros/tests/golden/traits_generic_child.rs
  • gts-macros/tests/golden/traits_inline_chain.rs
  • gts-macros/tests/golden/traits_referenced_chain.rs
  • gts-macros/tests/golden/traits_schema_narrowing.rs
  • gts-macros/tests/golden/traits_struct_literal.rs
  • gts-macros/tests/inheritance_tests.rs
  • gts-macros/tests/inheritance_tests_mixed.rs
  • gts-macros/tests/instance_macro_tests.rs
  • gts-macros/tests/integration_tests.rs
  • gts-macros/tests/optional_generic_chain_tests.rs
  • gts-macros/tests/optional_generic_serde_attrs_tests.rs
  • gts-macros/tests/optional_generic_tests.rs
  • gts-macros/tests/pretty_test.rs
  • gts-macros/tests/schema_declaration_tests.rs
  • gts-macros/tests/serde_rename_tests.rs
  • gts-macros/tests/traits_tests.rs
  • gts-macros/tests/value_dispatch_tests.rs

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

  • 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.

Share

@code-ranker-app

code-ranker-app Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

code-ranker

Built on a fork. View full report ↗

rust
Metric Baseline Current Δ
Structure
Files 57 58 +1
Folders 8 9 +1
Edges 240 244 +4
Nodes in cycles 21 23 $\color{#c0392b}{+2}$
Complexity
cognitive — Cognitive complexity 52 51.3 $\color{#2a7a30}{-0.666}$
cyclomatic — Cyclomatic complexity 75.7 74.7 $\color{#2a7a30}{-0.937}$
Coupling
fan_in — Incoming dependencies 3.4 3.4 -0.009
fan_out — Outgoing dependencies 3.7 3.7 -0.017
hk — God-object risk 384.3K 374K $\color{#2a7a30}{-10.3K}$
Halstead
bugs — Estimated bugs 2 2 $\color{#2a7a30}{-0.026}$
effort — Implementation effort 763.8K 749.9K $\color{#2a7a30}{-13.9K}$
length — Total tokens 1338 1321 $\color{#2a7a30}{-17.1}$
time — Coding time (s) 42.4K 41.7K $\color{#2a7a30}{-772}$
vocabulary — Distinct symbols 147 147 $\color{#2a7a30}{-0.641}$
volume — Code volume 10.8K 10.6K $\color{#2a7a30}{-156}$
Lines of Code
blank — Blank lines 33.7 33 -0.702
cloc — Comment lines 85.4 83.5 -1.9
sloc — Source lines 292 289 -3.5
tloc — Test lines 335 327 -7.9
Maintainability
mi — Maintainability index 44 43.8 $\color{#c0392b}{-0.201}$

@codecov-commenter

codecov-commenter commented Nov 9, 2026 •

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 95.11111% with 11 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
gts-cli/src/gen_schemas/source.rs 92.92% 8 Missing ⚠️
gts-cli/src/gen_schemas.rs 98.09% 2 Missing ⚠️
gts-cli/src/cargo_main.rs 0.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

- Skip parsing files without schema declarations and ignore walk errors in excluded directories.
- Parse macro arguments directly and write Makefile-generated schemas to target/schemas.
- Cover skipped syntax errors, excluded paths, and invalid declarations with regression tests.

Signed-off-by: Aviator 5 <ai.agent.tor@gmail.com>

This branch has not been deployed

No deployments
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.

gts-macros: make dir_path optional in struct_to_gts_schema

2 participants