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

zed expand <...> --json does not match the expected schema #119

Open
williamdclt opened this issue May 6, 2022 · 2 comments
Open

zed expand <...> --json does not match the expected schema #119

williamdclt opened this issue May 6, 2022 · 2 comments
Labels
area/CLI Affects the command line area/dependencies Affects dependencies kind/tech debt Addresses legacy code/decisions priority/2 medium This needs to be done

Comments

@williamdclt
Copy link

The JSON output of zed expand returns something like:

{
  "expandedAt": {
    "token": "GgMKATY="
  },
  "treeRoot": {
    "expandedObject": {
      "objectId": "aae48b55-ad96-11eb-a562-06368a59bfb7",
      "objectType": "care_recipient"
    },
    "expandedRelation": "agency",
    "leaf": {}
  }
}

Whereas the API returns, for the same request:

{
  "expandedAt": {
    "token": "GgMKATY="
  },
  "treeRoot": {
    "treeType": {
      "oneofKind": "leaf",
      "leaf": {
        "subjects": []
      }
    },
    "expandedRelation": "agency",
    "expandedObject": {
      "objectType": "care_recipient",
      "objectId": "aae48b55-ad96-11eb-a562-06368a59bfb7"
    }
  }
}

In the zed response, we do not have the treeType attribute

@williamdclt
Copy link
Author

It also seems that for intermediate nodes, zed returns the operation attribute as something like "OPERATION_EXCLUSION" rather than 2 like the API

@jzelinskie
Copy link
Member

We actually hadn't considered making the zed --json flag compatible with rest gateway, but it seems obvious in retrospect.

Looks like this is a difference between just calling protojson on the result vs how grpc gateway calls protojson.

I could see two ways of fixing this:

  1. making the --json flag actually perform a REST request instead of gRPC
  2. try make both sources generate the same output

I think I'm leaning towards the first option as just dumping the request with protojson was kinda a hack so we could use jq before we ever had an HTTP API.

@jzelinskie jzelinskie added area/CLI Affects the command line priority/2 medium This needs to be done kind/tech debt Addresses legacy code/decisions area/dependencies Affects dependencies labels May 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/CLI Affects the command line area/dependencies Affects dependencies kind/tech debt Addresses legacy code/decisions priority/2 medium This needs to be done
Projects
None yet
Development

No branches or pull requests

2 participants