openfga / openfga/cli

WriteAuthorizationModel error is too verbose

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

Nobody has claimed this yet.

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

Description

[12/09/23 10:06:31] ~/GitHub/cli (main) $ cat /Users/mparnisari/Desktop/demo/model.fga
model
  schema 1.1
type user
type group
  relations
    define member: [user]
type folder
  relations
    define parent: [folder]
    define viewer: [user,user:*,group#member] or viewer from parent
type document
  relations
    define parent: [folder2]
    define viewer: [user,user:*,group#member] or viewer from parent%
[12/09/23 10:07:27] ~/GitHub/cli (main) $ ./dist/fga model write --store-id 01HA35BW7NGWXK9490E0ES39QZ --file /Users/mparnisari/Desktop/demo/model.fga
Error: failed to write model due to WriteAuthorizationModel validation error for POST WriteAuthorizationModel with body {"code":"invalid_authorization_model","message":"the relation type 'folder2' on 'parent' in object type 'document' is not valid"}
 with error code invalid_authorization_model error message: the relation type 'folder2' on 'parent' in object type 'document' is not valid
[12/09/23 10:07:29] ~/GitHub/cli (main) $

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

Start at the model write command and trace how the server validation error is formatted for the CLI. Compare the duplicated error text shown in the report and identify the expected concise output from the issue context. Add or update coverage for this failure path so the command reports the validation message without redundant details.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.