Skip to content

Wishlist: Flag to verify filter syntax #3374

@VictorEngmarkHexagon

Description

@VictorEngmarkHexagon

After writing a small handful of larger jq filters, one thing which would be really useful would be some way to verify that a filter is syntactically valid, without actually running it on any particular JSON input. Ideally in a way which is easily integrated into pre-commit, which would mean

  1. not relying on shell features like standard input to pass some valid JSON to run the filter against, and
  2. being able to pass multiple .jq files to verify in a single command.

Workarounds:

  • I tried running jq --from-file my.jq --null-input, but that resulted in "jq: error (at ): null (null) has no keys".
  • jq --from-file my.jq <<< {}, echo '{}' | jq --from-file my.jq and the like work, but rely on standard input.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions