Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds JSONSchema generation capability to the RouteE-Compass configuration system using the schemars crate. The schema enables IDE intellisense/autocomplete support for JSON and YAML configuration files, improving developer experience when writing Compass configurations.
Changes:
- Added
schemarsdependency withindexmap2feature and enabledschemarsfeature forordered-float - Created
compass-schemabinary for schema generation and scripts for generating/testing schema output - Derived
JsonSchemafor all configuration types, with custom implementations for complex types likeStateVariableConfig,OneOrMany, and config wrappers - Refactored constraint model builders (turn restrictions, road class, vehicle restrictions) to use dedicated config structs instead of direct JSON parsing
- Migrated from
ordered_hash_maptoindexmapfor ordered collections - Updated
uomdependency from 0.36.0 to 0.38.0 - Extracted
EdgeListSearchConfigtype, replacing the previous inlineSearchConfig
Reviewed changes
Copilot reviewed 68 out of 70 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| scripts/test-compass-schema.sh | Schema validation script (has logic issue) |
| scripts/generate-compass-schema.sh | Schema generation script |
| scripts/intellisense-settings.json | Example IDE settings for schema-based intellisense |
| rust/routee-compass/src/bin/compass-schema.rs | Binary to generate JSON schema (missing Cargo.toml declaration) |
| rust/Cargo.toml | Added schemars, updated indexmap and uom dependencies |
| rust/routee-compass/Cargo.toml | Added indexmap and schemars dependencies, removed ordered_hash_map |
| rust/routee-compass-core/Cargo.toml | Added schemars dependency |
| rust/routee-compass/src/app/compass/edge_list_search_config.rs | New config type with custom JsonSchema implementations for traversal/constraint configs |
| rust/routee-compass/src/app/compass/compass_app_config.rs | Updated to use EdgeListSearchConfig |
| rust/routee-compass/src/app/compass/mod.rs | Exported EdgeListSearchConfig, removed SearchConfig export |
| rust/routee-compass-core/src/model/constraint/default/*/config.rs | New config structs for constraint models |
| rust/routee-compass-core/src/model/constraint/default/*/builder.rs | Refactored to use config structs |
| rust/routee-compass/src/app/compass/response/*.rs | Migrated OrderedHashMap to IndexMap |
| Multiple unit/config files | Added JsonSchema derives |
| docs/compass-config-schema.json | Generated schema output |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
rust/routee-compass-core/src/model/constraint/default/turn_restrictions/config.rs
Outdated
Show resolved
Hide resolved
...utee-compass-core/src/model/constraint/default/turn_restrictions/turn_restriction_builder.rs
Outdated
Show resolved
Hide resolved
rust/routee-compass-core/src/model/constraint/default/road_class/road_class_builder.rs
Outdated
Show resolved
Hide resolved
* guard examples with main function; update conversion script * update examples based on latest changes * fix search pruning taking out parents * add unit tests to FrontierInstance::pop_new
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 PR wires in schemars for JSONSchema generation of the CompassAppConfig object and its nested types. a binary compass-schema is in the routee-compass/src/bin folder and is called by a set of new scripts/ for creating the schema output and potentially testing for schema changes in CI in some future. there's also an example of intellisense settings which can be used to validate a file. these currently only trigger when the file has the file name "*.compass.{yaml|json|toml}".
HOWEVER, this doesn't seem to work for TOML, at least in my dev env. it's supported for JSON and YAML and i saw it in action with YAML. the results are a start (see below), but don't really seem to be "autocomplete", instead they come across as "error checking". i'm stopping there but we can fiddle with this to see if it's useful.