New generic manager "jsonpath", allowing json, yaml, toml, ..? #14684
LittleFox94
started this conversation in
Suggest an Idea
Replies: 1 comment 3 replies
-
This would be really great! I'd love to see it. BTW I think you could model it like "autodetect the file type based on extension, but allow manually specifying it"? that way if there's a file like |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
analog to the regex manager, but quite a bit easier to configure, a new manager reading common config file formats and extracting package name and version via jsonpaths could be useful
Example usage
Considering the files below, this manager would be able to find the git repository and docker images referenced in
my_config.yaml
, while being configurable for lots of different config files as long as they are in a supported format. In the example, the file format is being auto detected (by file extension or other heuristics) but a config to define it would probably be good.The idea is to configure jsonpaths to a collection of "entries". If the found "entries" is a list, details for each element in it are extracted, if "entries" is an object, each key is considered an entry and
match
,depName
anddepVersion
will operate on an object{"key": $originalKey, "value": $originalValue }
.match
defines a check an entry has to pass before it's considered by this manger, in this case they check if the keygit
ordocker
is defined, using that as differentiation whichdatasource
to use. Matches can be more complex, something like".type = 'docker'"
could make sense if the config file to parse has a usabletype
field already. Of the listmatch
only one element has to match for the entry to be considered; it's a logicalor
.depName
anddepVersion
are jsonpaths to extract dependency name and version from an entry.Just to have another example, this manager could parse a
npm
package.json
with a config like this:I'd try to implement that myself, if discussion is positive :)
Beta Was this translation helpful? Give feedback.
All reactions