Skip to content

Conversation

@ahouseholder
Copy link
Contributor

@ahouseholder ahouseholder commented Sep 11, 2025

I took the opportunity to refactor much of what we added to the SelectionList object into the _SchemaVersioned mixin.

Warning

Breaking Change
This PR changes the file names of data/schema/v2/*.schema.json. That likely means that the calculator and other UI things might need to change the URLs they're drawing from. However, this seemed to be a worthwhile tradeoff to allow us to move forward with automatically generating schemas consistently.

If desired, we could leave filesystem links behind from the old names. I have not done that as of creating this PR though.

Copilot Summary

This pull request refactors schema handling and generation for SSVC objects, improving consistency, maintainability, and future extensibility. The main changes include consolidating schema version logic into a mixin, updating schema files to use new naming conventions and metadata, and simplifying schema dumping in documentation tooling.

Schema handling and generation improvements:

  • Added a _schema_version class variable and related schema filename, path, and URL generation methods to the _SchemaVersioned mixin in src/ssvc/_mixins.py, centralizing schema version logic and enabling consistent schema metadata and file naming for all SSVC models. (src/ssvc/_mixins.py) [1] [2]
  • Updated all SSVC model classes (DecisionPoint, DecisionTable, DecisionPointGroup, SsvcObjectRegistry) to use the new _schema_version logic and removed redundant schema version validators, ensuring a single source of truth for schema versioning. (src/ssvc/decision_points/base.py, src/ssvc/decision_tables/base.py, src/ssvc/dp_groups/base.py, src/ssvc/registry/base.py) [1] [2] [3] [4]

Schema file and metadata updates:

  • Renamed schema files in data/schema/v2/ to use a consistent naming convention and updated their contents to include $schema, $id, and a standardized description, improving schema discoverability and standards compliance. (data/schema/v2/DecisionPoint_2_0_0.schema.json, data/schema/v2/DecisionTable_2_0_0.schema.json, data/schema/v2/DecisionPointGroup_2_0_0.schema.json, data/schema/v2/SsvcObjectRegistry_2_0_0.schema.json) [1] [2] [3] [4]

Documentation and tooling simplification:

  • Refactored src/ssvc/doctools.py to use the new schema filename/path utilities, removed legacy filename helpers, and streamlined schema dumping logic to automatically handle all relevant SSVC classes. (src/ssvc/doctools.py) [1] [2] [3]

General codebase consistency:

  • Updated copyright years and imports for accuracy and future-proofing. (src/ssvc/_mixins.py) [1] [2]

These changes collectively modernize SSVC schema management and make it easier to maintain and extend in the future.

@ahouseholder ahouseholder linked an issue Sep 11, 2025 that may be closed by this pull request
@ahouseholder ahouseholder self-assigned this Sep 11, 2025
@ahouseholder ahouseholder added tech/backend Back-end tools, code, infrastructure tech/data Data implementation (content of /data, data object instances, etc.) labels Sep 11, 2025
@ahouseholder ahouseholder added this to the 2025-09 milestone Sep 11, 2025
Copy link
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 refactors JSON schema generation for SSVC objects to improve consistency and maintainability. The main changes consolidate schema version logic into a central mixin, update schema files to use new naming conventions with standardized metadata, and simplify schema generation tooling.

  • Moved schema version handling from individual classes to the _SchemaVersioned mixin
  • Updated schema files to use consistent naming pattern (ClassName_X_Y_Z.schema.json) and added standard metadata
  • Simplified schema dumping in doctools.py to automatically handle all SSVC classes using new utilities

Reviewed Changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/ssvc/_mixins.py Added schema filename, path, and URL generation methods to _SchemaVersioned mixin
src/ssvc/selection.py Removed custom schema metadata generation, now uses mixin functionality
src/ssvc/registry/base.py Removed custom schema version validator, uses mixin's _schema_version
src/ssvc/dp_groups/base.py Removed custom schema version validator, added deprecation warning to schema description
src/ssvc/decision_tables/base.py Removed custom schema version validator, uses mixin's _schema_version
src/ssvc/decision_points/base.py Added _schema_version class variable for consistency
src/ssvc/doctools.py Refactored to use new schema utilities, simplified schema dumping logic
src/ssvc/utils/misc.py Added filename_friendly function for consistent filename generation
src/ssvc/utils/defaults.py Added SCHEMA_BASE_URL constant
data/schema/v2/*.schema.json Renamed files and updated with standard metadata ($schema, $id, description)
Test files Updated to use new schema filenames and import structure

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

ahouseholder and others added 2 commits September 11, 2025 17:15
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
@ahouseholder ahouseholder merged commit 1aa368e into main Sep 12, 2025
4 checks passed
@ahouseholder ahouseholder deleted the 901-schema-and-id-missing branch September 12, 2025 13:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tech/backend Back-end tools, code, infrastructure tech/data Data implementation (content of /data, data object instances, etc.)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

$schema and $id missing

3 participants