Repository navigation
feat!: add error category classes and the limit property - #74
Merged
Merged
Conversation
Add OscalDocumentTypeMismatchError (a subclass of OscalParseError) for the typed parsers, and OscalUnknownElementTypeError for validate_element. Add OscalParseError.limit, which names the documented limit that stopped a parse (ERR-009, ERR-010). The conformance runner now reads the error class only. BREAKING CHANGE: validate_element raises OscalUnknownElementTypeError, not OscalParseError, for an element type that the library does not recognize. Closes #60
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #60
Changes
OscalDocumentTypeMismatchError(OscalParseError): the eight typed parsers raise it for a document of another type. The message is unchanged.OscalUnknownElementTypeError(Exception):validate_elementraises it for an element type that the library does not recognize.OscalParseError.limit: the identifier of the documented limit that stopped the parse (json_depth,json_digits,yaml_alias_nodes,yaml_alias_characters,yaml_depth,yaml_line_break_placeholders), elseNone. Entry types are unchanged..agents/summary/updated. The change is archived anderror-testsis added to the main specs.Breaking change
validate_elementno longer raisesOscalParseErrorfor an unrecognized element type. It raisesOscalUnknownElementTypeError, which is not a subclass ofOscalParseError(ERR-008, ERR-009). Code that catchesOscalParseErroraroundvalidate_elementfor this case must catch the new class.Benchmarks (median of 7, GC on / GC off, ms)
parse_oscal(bytes)serialize_oscal(doc, indent=None)serialize_oscal(doc)doc.model_dump_json()pydantic_core.to_json(doc)Memory (peak MB) is identical: 36.5, 84.3, 144.4, 146.4. No median moves more than the run-to-run spread.
hatch run releasepasses.