You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Derive the resource identifier from a key and report the builder-error category (BMB-004, ERR-013) #62
Derive the resource identifier from a caller key in make_resource, and report the builder-error category for each validation error of the back-matter builders.
make_resource accepts an optional key. It generates a fresh identifier only when the caller gives neither an identifier nor a key.
When the caller gives a key and no identifier, the identifier is the UUID version 5 of the UTF-8 bytes of the key, in the namespace 3942257f-e1cf-5e06-9c6f-eeb97ecabe77. An empty key, or a key with an identifier, is a validation error.
Each validation error of a back-matter builder is in the new builder-error category of [ERR-001]. It is not a parse error.
make_resource in src/oscal_bindings/v1/extensions/builders.py has no key input. It raises pydantic.ValidationError for invalid input, and no error type is in the builder-error category.
Tasks
When the binding moves its pin to v0.8.0+oscal.1.2.3 or later, add a builder-error category to the error types. It must not be a parse error.
Add a key input to make_resource. Apply [BMB-004]. Use the UUID version 5 of the Python standard library with the namespace of the requirement. Do not derive the namespace again.
Report the builder-error category for an empty key, for a key with an identifier, and for each other validation error of make_hash, make_rlink, and make_resource ([ERR-013.01], [ERR-013.02]). This includes the unknown hash algorithm of make_hash raises ValueError, not ValidationError, for an unknown algorithm #53.
Add the build-resource operation to the corpus runner. A case has arguments (key, and optional title and identifier) and no input. Compare the uuid of the resource with expected-uuid, or check that the builder reports expected-category. The corpus has five cases, build-resource/*.
Add tests for [BMB-004.02] and [BMB-004.03] if the corpus runner does not cover them. [BMB-004.01] to [BMB-004.05] each have a corpus case or a test.
Activity
chore: move the spec pin to v0.8.0+oscal.1.2.3 (#70)
feat!: add OscalBuilderError and a key for make_resource