Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support user-provided JQ modules #565

Open
goedelsoup opened this issue Jan 22, 2025 · 2 comments
Open

Support user-provided JQ modules #565

goedelsoup opened this issue Jan 22, 2025 · 2 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@goedelsoup
Copy link

Is your feature request related to a problem? Please describe.

I frequently have to replicate filters between numerous Weaver configurations in order to support providing our customers with a consistent SDK across languages. It would be great to consolidate the filtering logic alongside my registry definitions and templates.

Describe the solution you'd like

Forge currently loads a default module while provides the helper functions authors would typically use for their template generation. It would be great if we could supply additional modules to load via the weaver generate command.

Describe alternatives you've considered

Many warts encountered when dealing with deprecated elements could be worked around by adding a exclude_attribute and exclude_metric option on the relevant functions, however, user-defined JQ modules would provide better composition long-term under the multi-registry support model.

@lquerel
Copy link
Contributor

lquerel commented Jan 22, 2025

Supporting the addition of a JQ prelude alongside the one already in place doesn’t seem very complicated. We could leverage 1) the existing override mechanism used for building the weaver.yaml configuration (see this doc), and 2) the introduction of a new field in the WeaverConfig structure that allows adding one or more JQ prelude files. This would enable the predefined prelude to be supplemented with one or more custom JQ preludes shared across multiple template directories.

Question: Would you prefer to have the option to completely bypass the default JQ prelude, or would the ability to add additional preludes be sufficient?

If someone is interested in implementing this request, I can provide more details.

@lquerel lquerel added enhancement New feature or request help wanted Extra attention is needed labels Jan 22, 2025
@goedelsoup
Copy link
Author

My initial idea was just to be able to supply modules in addition to the prelude, as they utilize some of the prelude functions. I personally don't see any reasonable need to exclude the prelude; even in scenarios where one may want to lint/validate that only certain functions were used, I'd imagine that'd be a positive assertion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
Status: No status
Development

No branches or pull requests

2 participants