Repository navigation
Add extension_or_* parser modes that load config files based on their extension - #1021
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1021 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 27 27
Lines 9857 9886 +29
=========================================
+ Hits 9857 9886 +29 ☔ View full report in Codecov by Harness. |
[Medium impact] The new behavior reaches config parsing across the parser's supported file-loading paths. The PR appears safe to merge, with a non-blocking fix needed for format detection on URLs with query strings. Findings
SummaryAdds
|
|



What does this PR do?
Adds
extension_or_*parser modes, e.g.parser_mode="extension_or_yaml", so that a single parser can load config files of different formats. Each config file is loaded in the format given by its extension (.json,.yaml/.yml,.toml,.jsonnet/.libsonnet), while files with unknown extensions, values given on the command line or via environment variables, and dumping use the mode after the prefix. If the base mode can already load the detected format, it is kept, e.g.extension_or_omegaconfstill uses omegaconf for YAML files andextension_or_yamlfor JSON files.This applies to all ways config files are loaded:
--configarguments, default config files,__include__(so a JSON config can include a TOML one) and sub-config paths for typed arguments. Provenance line numbers are shown according to each file's detected format.Before submitting