Skip to content

fix: list each manifest type as an element type - #73

Merged
dfkunstler merged 2 commits into
mainfrom
fix/list-each-manifest-element-type
Nov 17, 2026
Merged

dfkunstler merged 2 commits into
mainfrom
fix/list-each-manifest-element-type

Conversation

@dfkunstler

Copy link
Copy Markdown
Member

Closes #59

Summary

  1. get_supported_element_types() returns 244 names: 187 object and document types, 44 enums, and 13 unions. It matches the element-types/all corpus case (ELV-002).
  2. validate_element accepts each listed name. An enum validates from its string value (ELV-001). A union validates through a TypeAdapter in left_to_right mode, made on first use and cached. The type of element changes from dict[str, Any] | None to Any.
  3. The conformance runner runs the element-types operation. The element-types/all expected failure is removed, and the pre-fix snapshot of the list is deleted.
  4. The change is archived in this PR (openspec/changes/archive/2026-11-16-list-each-manifest-element-type).

Breaking change

root-model is no longer an element type. validate_element(x, "root-model") raises the unknown-element-type OscalParseError. The name came from the RootModel import in models.py and was never an OSCAL type.

Out of scope

Which branch a failure of a union element reports: #69. models.py and the post-processor are unchanged.

Benchmarks

Python 3.14.8, pydantic 2.14.2. Median of 7 runs, SP 800-53 rev5 catalog. "After" is two runs, because the run-to-run spread is as large as any difference.

Path Before GC on / off ms After 1 GC on / off ms After 2 GC on / off ms
parse_oscal(bytes) 64.0 / 47.4 63.3 / 46.0 65.5 / 47.4
serialize_oscal(doc, indent=None) 132.9 / 129.0 135.2 / 129.1 138.0 / 132.5
serialize_oscal(doc) 142.1 / 134.7 144.1 / 137.1 149.0 / 139.0
doc.model_dump_json() 139.5 / 133.7 141.2 / 135.0 142.0 / 136.7
pydantic_core.to_json(doc) 140.7 / 135.2 142.2 / 136.0 143.2 / 136.3

No median moves by more than the spread between the two "after" runs (up to about 5 ms). Peak memory is unchanged: 36.5 / 84.4 / 144.4 / 146.4 MB before, 36.5 / 84.3 / 144.4 / 146.4 MB after. The change touches no parse or serialize path, and adds nothing at import. PERFORMANCE.md is unchanged.

Verification

hatch run release passes. models.py has no drift.

The branch has two commits (the first holds only the snapshot deletion), so squash on merge.

get_supported_element_types() now returns 244 names: the 187 object and
document types, the 44 enums, and the 13 unions. validate_element accepts
each name; an enum validates from its string value and a union through a
cached TypeAdapter. The element parameter is typed Any.

BREAKING: `root-model` is no longer an element type. It was never an
OSCAL type.

The conformance runner runs the element-types operation, so the
element-types/all case passes and its expected failure is removed. The
pre-fix snapshot of the list is deleted.

Closes #59
get_supported_element_types() now returns 244 names: the 187 object and
document types, the 44 enums, and the 13 unions. validate_element accepts
each name; an enum validates from its string value and a union through a
cached TypeAdapter. The element parameter is typed Any.

BREAKING: `root-model` is no longer an element type. It was never an
OSCAL type.

The conformance runner runs the element-types operation, so the
element-types/all case passes and its expected failure is removed. The
archived OpenSpec change is included.

Closes #59
@dfkunstler
dfkunstler merged commit b97021e into main Nov 17, 2026
6 checks passed
@dfkunstler
dfkunstler deleted the fix/list-each-manifest-element-type branch November 17, 2026 03:02
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.

Return one element-type name for each manifest type (ELV-002)

1 participant