Repository navigation
refactor(exporters): read typed ident, CCI and metadata mappings in the engine - #62
Merged
Merged
Conversation
…he engine
ConfigLoader.load hands back the StyleConfig its last check built (the
merged style) as MappingConfig.style. The ident, CCI lookup and metadata
builders take their mapping's model: generate_idents_from_config,
generate_metadata_from_config, _build_config_element, _metadata_attributes,
_cci_service, get_ccis_with_deduplication and the metadata holders.
The defaults those reads carried are stated once in the models: every
transform defaults to "none", an ident's system_template to "" and its
value_template to "{item}", an ident attribute's template to "", and
cci_lookup.extract to "all". The ident's missing-name check goes: the
schema refuses an ident attribute without a name when the style loads.
The 28 exports are byte-identical.
Refs: cis-bench-fh9l.8
Signed-off-by: Aaron Lippold <lippold@gmail.com>
…tes no ident Refs: cis-bench-fh9l.8 Signed-off-by: Aaron Lippold <lippold@gmail.com>
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.
The engine now reads the style model that
ConfigLoadervalidated for the ident, CCI lookup and metadata mappings, instead of dicts with a default at each.get().ConfigLoader.loadhands back theStyleConfigbuilt by its last check (the merged style) asMappingConfig.style. There is no second validation.MappingConfigitself goes in cis-bench-fh9l.9.generate_idents_from_config,generate_metadata_from_config,_build_config_element,_metadata_attributes,_cci_service,get_ccis_with_deduplicationand the metadata-holder setup.map_rulepasses the typed mapping to the ident and metadata builders..get()calls in those methods went from 28 to 2. The two left readmetadataandcci_deduplication, not field mappings. The whole file went from 101 to 74."none", an ident'ssystem_templateis""and itsvalue_template"{item}", an ident attribute'stemplateis"", andcci_lookup.extractis"all". The published style JSON Schema now shows these defaults, and no longer lists null for them; null was already refused.StyleConfig.cci_lookupreturns thecci_lookupof the mapping namedident, as the engine read it before.source_fieldor an emptyident_specstill writes no ident (measured onnext); a new test covers both.Checks:
tests/scripts, mypy, ruff andmkdocs build --strictpass.nextand passcis-bench validate.Card: cis-bench-fh9l.8. The map_rule dispatch and the remaining builders are cis-bench-fh9l.14.