Skip to content

Rjf/json schema#472

Open
robfitzgerald wants to merge 14 commits intomainfrom
rjf/json-schema
Open

Rjf/json schema#472
robfitzgerald wants to merge 14 commits intomainfrom
rjf/json-schema

Conversation

@robfitzgerald
Copy link
Copy Markdown
Collaborator

@robfitzgerald robfitzgerald commented Feb 17, 2026

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.

Screenshot 2026-02-17 at 2 19 01 PM Screenshot 2026-02-17 at 2 19 59 PM

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 schemars dependency with indexmap2 feature and enabled schemars feature for ordered-float
  • Created compass-schema binary for schema generation and scripts for generating/testing schema output
  • Derived JsonSchema for all configuration types, with custom implementations for complex types like StateVariableConfig, 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_map to indexmap for ordered collections
  • Updated uom dependency from 0.36.0 to 0.38.0
  • Extracted EdgeListSearchConfig type, replacing the previous inline SearchConfig

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.

robfitzgerald and others added 7 commits February 17, 2026 14:42
* 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
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.

3 participants