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

Inconsistent gRPC REST endpoint format #1152

Closed
4 tasks
Tracked by #818
ryanchristo opened this issue Jun 2, 2022 · 2 comments · Fixed by #1198
Closed
4 tasks
Tracked by #818

Inconsistent gRPC REST endpoint format #1152

ryanchristo opened this issue Jun 2, 2022 · 2 comments · Fixed by #1198
Assignees
Labels
Type: Refactor A code change that neither fixes a bug nor adds a feature

Comments

@ryanchristo
Copy link
Member

ryanchristo commented Jun 2, 2022

Summary

We currently have no clear guidelines on how to write gRPC REST endpoints and we are using a few different formats.

When we query for projects by credit class (we use classes as the root and add projects after {class_id}):

"/regen/ecocredit/v1/classes/{class_id}/projects"

When we query for projects by reference id (we use projects as the root and then by-reference-id):

"/regen/ecocredit/v1/projects/by-reference-id/{reference_id}"

When we query for batches by class (we use batches as the root and then class):

"/regen/ecocredit/v1/batches/class/{class_id}"

Problem Definition

Using a consistent format for gRPC REST endpoints will provide a better user experience.

Proposal

[ work in progress ]


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned
@ryanchristo ryanchristo added the Type: Refactor A code change that neither fixes a bug nor adds a feature label Jun 2, 2022
@ryanchristo ryanchristo added this to the v4.0 - Llangorse Upgrade milestone Jun 2, 2022
@ryanchristo ryanchristo self-assigned this Jun 6, 2022
@ryanchristo
Copy link
Member Author

It looks like other sdk projects are using the format <object>_by_<value> (the sdk and osmosis) and this seems like the right direction but best practices for REST endpoints is to use - rather than _.

The data module in general could use more descriptive query method names and I'm not sure we want to make all the changes currently in #1156 but I thought it would be good to demonstrate what more descriptive endpoints might look like.

@ryanchristo
Copy link
Member Author

Also, we may want to make use of additional_bindings in some cases. In particular, the first example in this issue shouldn't have to be one or the other but rather both of the following:

"/regen/ecocredit/v1/classes/{class_id}/projects"
"/regen/ecocredit/v1/projects-by-class/{class_id}"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Refactor A code change that neither fixes a bug nor adds a feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant