Improve namespace implementation#824
Conversation
sei-vsarvepalli
left a comment
There was a problem hiding this comment.
All looks good and clear to me.. I will wait on Thomas' feedback if any over next week, then we can merge it off.
tschmidtb51
left a comment
There was a problem hiding this comment.
@ahouseholder Thank you for providing that. I missed the PR and therefore noted some comments in #780.
Main points:
- enforcement of reverse DNS
- provide option to separate organization (reverse DNS) and "model", e.g.
#
I look forward to our conversation on Monday
Co-authored-by: tschmidtb51 <[email protected]>
…private-and-extension-namespaces' into 780-clarify-distinction-between-private-and-extension-namespaces
…private-and-extension-namespaces' into 780-clarify-distinction-between-private-and-extension-namespaces
…-distinction-between-private-and-extension-namespaces
Also added more test strings
…sed) to avoid confusion with "example.org" which is also reserved
data/schema/v2/Decision_Point_Value_Selection-2-0-0.schema.json
Outdated
Show resolved
Hide resolved
…e domain expectation
…-distinction-between-private-and-extension-namespaces
|
For ease of figuring out what's new, I've marked all previous suggestions as resolved, and have re-requested review from @tschmidtb51 and @sei-vsarvepalli on the current version of the branch. |
|
I did just push (in afe9c61) a revamp of the Note Strictly speaking, this should have gone into the #821 branch, but I'm doing this in #824 instead of #821 because it depends on a previous refactoring that only exists in the #824 branch. To maintain parallelism with the full-size from ssvc.decision_points.base import DecisionPointValue
DecisionPointValue.model_json_schema()
Out[6]:
{'description': 'Models a single value option for a decision point.\n\nEach value should have the following attributes:\n\n- name (str): A name\n- description (str): A description\n- key (str): A key (a short, unique string) that can be used to identify the value in a shorthand way\n- _comment (str): An optional comment that will be included in the object.',
'properties': {'key': {'title': 'Key', 'type': 'string'},
'name': {'title': 'Name', 'type': 'string'},
'description': {'title': 'Description', 'type': 'string'}},
'required': ['key', 'name', 'description'],
'title': 'DecisionPointValue',
'type': 'object'}
from ssvc.selection import MinimalDecisionPointValue
MinimalDecisionPointValue.model_json_schema()
Out[8]:
{'description': 'A minimal representation of a decision point value.',
'properties': {'key': {'title': 'Key', 'type': 'string'}},
'required': ['key'],
'title': 'MinimalDecisionPointValue',
'type': 'object'}See commit diff for details of how this changes the JSON schema. |
|
Current preview of the resulting selection object: {
"schemaVersion": "2.0.0",
"selections": [
{
"namespace": "ssvc",
"key": "A",
"version": "2.0.0",
"values": [
{
"key": "N"
}
]
},
{
"namespace": "ssvc",
"key": "SI",
"version": "2.0.0",
"values": [
{
"key": "N"
},
{
"key": "M"
}
]
}
],
"timestamp": "2025-07-23T16:38:36Z"
} |
…for documentation
|
After discussion with @sei-vsarvepalli, we've agreed to merge this into #821 and will continue the wrap-up tasks in that PR |
b955ef7
into
820-add-a-minimalist-selection-object
ssvcnamespaces #753Decision_Point_Value_Selection.schema.jsonusing Pydantic #735Decision_Point_Value_Selection-1-0-1.schema.json#766This PR implements the namespace clarifications from #780.
Note
This PR builds on #821 and should either be merged into #821 or merged to
mainafter #821 is merged intomain.CoPilot Summary
This pull request introduces several changes to improve the SSVC codebase by enhancing schema definitions, modularizing utility functions, and refining namespace validation. The updates include adjustments to schema descriptions, the introduction of reusable field specifications and patterns, and modifications to test cases to align with the new namespace format.
Schema Improvements:
selectionsfield description: Expanded the description to clarify the relationship between selection items and decision points, emphasizing the minimal nature of selection objects. (data/schema/v2/Decision_Point_Value_Selection-2-0-0.schema.json, data/schema/v2/Decision_Point_Value_Selection-2-0-0.schema.jsonL32-R32)Namespaceexamples and pattern: Enhanced the namespace validation pattern to support additional characters (#) and complex structures while ensuring compliance with length and format constraints. (data/schema/v2/Decision_Point_Value_Selection-2-0-0.schema.json, data/schema/v2/Decision_Point_Value_Selection-2-0-0.schema.jsonL67-R72)Codebase Modularization:
src/ssvc/utils/defaults.py: Consolidated constants such asDEFAULT_VERSION,X_PFX, andFIELD_DELIMITER.src/ssvc/utils/field_specs.py: Defined reusable Pydantic field specifications forVersionString,NamespaceString, andTargetIdList.src/ssvc/utils/patterns.py: Centralized regex patterns for semantic versioning and namespace validation.src/ssvc/_mixins.py, [1];src/ssvc/selection.py, [2]Namespace Validation Enhancements:
#) and refined validation logic to prevent consecutive separators. (src/ssvc/namespaces.py, src/ssvc/namespaces.pyL89-R39)x_example.test) for consistency. (src/test/decision_points/test_dp_base.py, [1];src/test/decision_points/test_dp_helpers.py, [2];src/test/dp_groups/test_dp_groups.py, [3];src/test/outcomes/test_outcomes.py, [4];src/test/test_doc_helpers.py, [5]