openfga / openfga/cli

Add support for --jq or --format=jsonpath='$.store.id'

Open
#395 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement hacktoberfest
Dominant language
Go
Stars
102
Forks
49
Avg merge
1d 1h
Merged PRs (30d)
16

Description

CLI can output result in JSON format but it does not provide means to transform the output which is handy in more standardized environments like Kubernetes. For example in the readme of the CLI the suggestion to obtain the store ID is

export FGA_STORE_ID=$(fga store create --model model.fga | jq -r .store.id)

which is fine when you are in local but it imposes difficulties in container environments because e.g. the container that includes cli does not include JQ so doing this transformation would require either 2 init containers or create an image that has both cli and jq.

This is not a new issue, that is why tools like kubectl or gh include output transformations support.

For example:

  • kubectl get pods -o=jsonpath="{range .items[*]}{.metadata.name}{'\t'}{.status.startTime}{'\n'}{end}"
  • gh pr list --json author --jq '.[].author.login'

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue describes the CLI's existing JSON output and the README's store-ID example; start by tracing the command path that produces JSON and reviewing the transformation approaches shown for kubectl and gh. Done means the CLI supports a defined jq or JSONPath-style transformation without requiring a separate jq container, with the README example updated accordingly.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.