Repository navigation
Accept xs:anyAttribute wildcards - #80
Merged
Merged
Conversation
A type with an xs:anyAttribute made DataModel fail with "'NoneType' object has no attribute 'is_union'": xmlschema lists the wildcard in the type's attributes under the key None, without a type. Skip it with a warning, as done for xs:any children in cre-dev#52. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Collaborator
|
Thanks, that is useful! |
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.
A type with an
xs:anyAttributewildcard makesDataModelfail while building the model:xmlschema lists the wildcard in the type's
attributesunder the keyNone, with no type, and the attribute loop in_parse_treepasses it torecurse_parse_simple_type. This change skips it with a warning, as #52 does forxs:anychildren: the schema is accepted and the wildcard content is not imported. No model config can avoid the error today, since it is raised before the config is applied.Found with SDMX 2.1 structure-specific data, for instance the ECB exchange rates schema (https://data-api.ecb.europa.eu/service/schema/dataflow/ECB/EXR/1.0). The SDMX base types
DataSetType,GroupType,SeriesTypeandObsTypedeclare<xs:anyAttribute namespace="##local"/>so that each data structure can add its own attributes by restriction. The wildcard cannot be removed from the schema: xmlschema then rejects the restrictions (Unexpected attribute 'CURRENCY' in restriction).Tests
Extrainorders.xsdgets anxs:anyAttribute, andequivalent_xml/order1a.xmlsets an attribute on<extra>. Without the change inmodel.py, 85 tests fail with the error above. With it, the suite passes on DuckDB (TZ="Europe/Paris" DB_STRING="duckdb:///:memory:" pytest: 229 passed, 73 skipped). Regenerating the snapshots withmodels.pychanges nothing, since the wildcard adds no column.Docs
A "Wildcards" caveat in
docs/how_it_works.md.mkdocs build --strictpasses.🤖 Generated with Claude Code