Preserve raw XBRL and tighten validation#10
Open
ThomasMarcelis wants to merge 1 commit into
Open
Conversation
a454ffb to
a911779
Compare
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.
This PR makes the parsed output keep more of the original XBRL instance document, and makes
Validate()report structural problems more explicitly.Main changes:
RawXBRL/XBRLnow preserve the root XML name and attributes, raw context/unit slices, and raw reference elements such asschemaRef,linkbaseRef,roleRef,arcroleRef, andfootnoteLink.InnerXML.scenarioelements are preserved as raw XML, but still rejected byValidate()because scenario support is not implemented.Validate()now checks contexts, units, duplicate IDs, period shape, entity identifiers, fact structure, broken fact references, and unsupported top-levelitem/tupleelements.Fact.Validate()now returns specific errors for malformed numeric, non-numeric, nil, and fraction facts.NumericValue()now returns errors for malformed numeric facts instead of panicking on missing fields.Parse,ParseReader, andDecodehelpers around the existingencoding/xmlflow.This is mostly additive API surface, but validation is intentionally stricter: some malformed documents that previously parsed without a useful validation error may now fail
Validate().Tests cover focused XML snippets, the existing AAPL and EDGR fixtures, examples, and parse/validate fuzzing.
Checked with
go test ./....