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

Remove the legacy REST API #7517

Closed
4 of 7 tasks
amaury1093 opened this issue Oct 12, 2020 · 7 comments · Fixed by #9650
Closed
4 of 7 tasks

Remove the legacy REST API #7517

amaury1093 opened this issue Oct 12, 2020 · 7 comments · Fixed by #9650
Assignees
Labels
Type: Code Hygiene General cleanup and restructuring of code to provide clarity, flexibility, and modularity.

Comments

@amaury1093
Copy link
Contributor

amaury1093 commented Oct 12, 2020

Summary

Remove the legacy REST API for v0.41.

Problem Definition

v0.40 introduced gRPC queries, which should be the preferred way of interacting with the app. For clients still wanting to use REST, all gRPC service methods are annotated to be accessible by REST + HTTP2, using grpc-gateway. Finally, for clients who don't support HTTP2 (e.g. browsers), a grpc-web-proxy is in the works.

All this removes the need of having a separate legacy REST API.

Proposal

  • in each module, remove the x/{module}/client/rest folder #9594.
  • remove all glue code between simapp/modules and the REST server #9594.

TODO:

  • in each module remove the legacy handler and querier #comment.

A clear migration path should also be provided.


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned
@amaury1093 amaury1093 added Legacy API Type: Code Hygiene General cleanup and restructuring of code to provide clarity, flexibility, and modularity. labels Oct 12, 2020
@amaury1093 amaury1093 added this to the v0.41 milestone Oct 12, 2020
@alexanderbez
Copy link
Contributor

Do we still not need server/api? That's where we serve metrics and the gRPC HTTP gateway, no?

@amaury1093
Copy link
Contributor Author

True, I updated the initial description.

@aaronc aaronc modified the milestones: v0.41, v0.42 Jan 6, 2021
@clevinson clevinson modified the milestones: Feature Backlog, v0.44 Jun 25, 2021
@aleem1314 aleem1314 self-assigned this Jun 28, 2021
mergify bot pushed a commit that referenced this issue Jul 6, 2021
<!--
The default pull request template is for types feat, fix, or refactor.
For other templates, add one of the following parameters to the url:
- template=docs.md
- template=other.md
-->

## Description

ref: #7517 

  * [x] Remove the x/{module}/client/rest folder
  * [x] Remove all glue code between simapp/modules and the REST server

<!-- Add a description of the changes that this PR introduces and the files that
are the most critical to review. -->

---

### Author Checklist

*All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.*

I have...

- [x] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title
- [x] added `!` to the type prefix if API or client breaking change
- [x] targeted the correct branch (see [PR Targeting](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#pr-targeting))
- [x] provided a link to the relevant issue or specification
- [ ] followed the guidelines for [building modules](https://github.com/cosmos/cosmos-sdk/blob/master/docs/building-modules)
- [ ] included the necessary unit and integration [tests](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#testing)
- [x] added a changelog entry to `CHANGELOG.md`
- [ ] included comments for [documenting Go code](https://blog.golang.org/godoc)
- [ ] updated the relevant documentation or specification - see #9615
- [x] reviewed "Files changed" and left comments if necessary
- [x] confirmed all CI checks have passed

### Reviewers Checklist

*All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.*

I have...

- [x] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title
- [x] confirmed `!` in the type prefix if API or client breaking change
- [ ] confirmed all author checklist items have been addressed 
- [ ] reviewed state machine logic
- [x] reviewed API design and naming
- [ ] reviewed documentation is accurate - see #9615
- [ ] reviewed tests and test coverage
- [ ] manually tested (if applicable)
@mergify mergify bot closed this as completed in #9650 Jul 19, 2021
mergify bot pushed a commit that referenced this issue Jul 19, 2021
<!--
The default pull request template is for types feat, fix, or refactor.
For other templates, add one of the following parameters to the url:
- template=docs.md
- template=other.md
-->

## Description

Closes: #7517 
ref: [comment](#9594 (comment))

<!-- Add a description of the changes that this PR introduces and the files that
are the most critical to review. -->

---

### Author Checklist

*All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.*

I have...

- [x] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title
- [x] added `!` to the type prefix if API or client breaking change
- [x] targeted the correct branch (see [PR Targeting](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#pr-targeting))
- [x] provided a link to the relevant issue or specification
- [ ] followed the guidelines for [building modules](https://github.com/cosmos/cosmos-sdk/blob/master/docs/building-modules)
- [ ] included the necessary unit and integration [tests](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#testing)
- [x] added a changelog entry to `CHANGELOG.md`
- [ ] included comments for [documenting Go code](https://blog.golang.org/godoc)
- [ ] updated the relevant documentation or specification
- [ ] reviewed "Files changed" and left comments if necessary
- [ ] confirmed all CI checks have passed

### Reviewers Checklist

*All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.*

I have...

- [ ] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title
- [ ] confirmed `!` in the type prefix if API or client breaking change
- [ ] confirmed all author checklist items have been addressed 
- [ ] reviewed state machine logic
- [ ] reviewed API design and naming
- [ ] reviewed documentation is accurate
- [ ] reviewed tests and test coverage
- [ ] manually tested (if applicable)
@albertchon
Copy link
Contributor

albertchon commented Jul 20, 2021

Removing REST API support in v0.44 is a bit questionable, as it's quite useful for clients. I assume this mean the swagger API queries won't work as well?

For some context, we use gRPC and gRPC-web almost exclusively in our clients but still have found the swagger + REST API to be a very useful debugging tool (e.g. a la https://staking-lcd.injective.network/swagger/) and for smaller monitoring bots and such.

I suppose projects can still support REST using a proxy (e.g. https://www.envoyproxy.io/docs/envoy/latest/configuration/http/http_filters/grpc_json_transcoder_filter#grpc-json-transcoder seems cool) but it's extra work

@amaury1093
Copy link
Contributor Author

Thanks for the feedback @albertchon!

Maybe this is understood, but I just want to re-clarify the following point: we currently have 2 types of REST endpoints:

  • the legacy REST API: these are defined inside each module's client/rest pkg, and wired up using RegisterRESTRoutes. For example, the endpoint to query a balance with the legacy endpoint is "/bank/balances/{address}", link.
  • the gRPC-gateway REST endpoints: these are defined directly inside *.proto files, and are just a "translation" of gRPC to REST using grpc-gateway. For example, "/cosmos/bank/v1beta1/balances/{address}", link.

The issue is about removing the 1st, and keeping the 2nd. I had a look at your Swagger file, they do list grpc-gateway endpoints (2nd type), so these will stay.

As for the 1st type (Legacy REST API), we put a sunset HTTP header since 0.40 #7686 (>6months), have docs to migrate to the new endpoints, and marked it as "legacy" everywhere the code. I believe that's enough notice for removing it.

0.44 still won't be out for some time, and I hope that gives your team enough time to migrate to the new REST endpoints. Please let us know if there are other concerns.

@alexanderbez
Copy link
Contributor

Just to reiterate @AmauryM's point. We kept in the legacy (non-gRPC, formally known as the lite API) API around for an entire release (multiple months). The idea was to give ample time to operators and developers to update their infra by switching to the new gRPC gateway API. Ideally, no one should be caught off guard by the legacy API being completely removed.

@albertchon
Copy link
Contributor

Awesome, it seems I misunderstood the change in the first place - thought you guys were doing away with REST entirely!

And yeah clients using the legacy API shouldn't really have a hard time migrating then, since it's just some minor API path changes.

@alexanderbez
Copy link
Contributor

Yes, exactly! :)

mergify bot pushed a commit that referenced this issue Aug 31, 2021
<!--
The default pull request template is for types feat, fix, or refactor.
For other templates, add one of the following parameters to the url:
- template=docs.md
- template=other.md
-->

## Description

ref: #7517

  * [x] Remove the x/{module}/client/rest folder
  * [x] Remove all glue code between simapp/modules and the REST server

<!-- Add a description of the changes that this PR introduces and the files that
are the most critical to review. -->

---

### Author Checklist

*All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.*

I have...

- [x] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title
- [x] added `!` to the type prefix if API or client breaking change
- [x] targeted the correct branch (see [PR Targeting](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#pr-targeting))
- [x] provided a link to the relevant issue or specification
- [ ] followed the guidelines for [building modules](https://github.com/cosmos/cosmos-sdk/blob/master/docs/building-modules)
- [ ] included the necessary unit and integration [tests](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#testing)
- [x] added a changelog entry to `CHANGELOG.md`
- [ ] included comments for [documenting Go code](https://blog.golang.org/godoc)
- [ ] updated the relevant documentation or specification - see #9615
- [x] reviewed "Files changed" and left comments if necessary
- [x] confirmed all CI checks have passed

### Reviewers Checklist

*All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.*

I have...

- [x] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title
- [x] confirmed `!` in the type prefix if API or client breaking change
- [ ] confirmed all author checklist items have been addressed
- [ ] reviewed state machine logic
- [x] reviewed API design and naming
- [ ] reviewed documentation is accurate - see #9615
- [ ] reviewed tests and test coverage
- [ ] manually tested (if applicable)

(cherry picked from commit cd22168)

# Conflicts:
#	CHANGELOG.md
#	client/tx/tx.go
#	codec/amino_codec_test.go
#	x/auth/client/cli/query.go
#	x/auth/client/rest/broadcast.go
#	x/auth/client/rest/decode.go
#	x/auth/client/rest/encode.go
#	x/auth/client/rest/rest_test.go
#	x/authz/client/testutil/grpc.go
#	x/bank/client/rest/query_test.go
#	x/bank/client/rest/tx_test.go
#	x/gov/client/testutil/grpc.go
#	x/mint/client/testutil/grpc.go
#	x/params/client/testutil/grpc.go
#	x/slashing/client/testutil/grpc.go
#	x/staking/client/testutil/grpc.go
mergify bot pushed a commit to desmos-labs/desmos that referenced this issue Mar 24, 2022
## Description

Closes: #566 

This PR removes all legacy handlers since it is no longer used.

See: cosmos/cosmos-sdk#7517



---

### Author Checklist

*All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.*

I have...

- [ ] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title
- [ ] added `!` to the type prefix if API or client breaking change
- [ ] targeted the correct branch (see [PR Targeting](https://github.com/desmos-labs/desmos/blob/master/CONTRIBUTING.md#pr-targeting))
- [ ] provided a link to the relevant issue or specification
- [ ] followed the guidelines for [building modules](https://docs.cosmos.network/v0.44/building-modules/intro.html)
- [ ] included the necessary unit and integration [tests](https://github.com/desmos-labs/desmos/blob/master/CONTRIBUTING.md#testing)
- [ ] added a changelog entry to `CHANGELOG.md`
- [ ] included comments for [documenting Go code](https://blog.golang.org/godoc)
- [ ] updated the relevant documentation or specification
- [ ] reviewed "Files changed" and left comments if necessary
- [ ] confirmed all CI checks have passed

### Reviewers Checklist

*All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.*

I have...

- [ ] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title
- [ ] confirmed `!` in the type prefix if API or client breaking change
- [ ] confirmed all author checklist items have been addressed
- [ ] reviewed state machine logic
- [ ] reviewed API design and naming
- [ ] reviewed documentation is accurate
- [ ] reviewed tests and test coverage
- [ ] manually tested (if applicable)
larry0x pushed a commit to larry0x/cosmos-sdk that referenced this issue May 22, 2023
<!--
The default pull request template is for types feat, fix, or refactor.
For other templates, add one of the following parameters to the url:
- template=docs.md
- template=other.md
-->

## Description

ref: cosmos#7517 

  * [x] Remove the x/{module}/client/rest folder
  * [x] Remove all glue code between simapp/modules and the REST server

<!-- Add a description of the changes that this PR introduces and the files that
are the most critical to review. -->

---

### Author Checklist

*All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.*

I have...

- [x] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title
- [x] added `!` to the type prefix if API or client breaking change
- [x] targeted the correct branch (see [PR Targeting](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#pr-targeting))
- [x] provided a link to the relevant issue or specification
- [ ] followed the guidelines for [building modules](https://github.com/cosmos/cosmos-sdk/blob/master/docs/building-modules)
- [ ] included the necessary unit and integration [tests](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#testing)
- [x] added a changelog entry to `CHANGELOG.md`
- [ ] included comments for [documenting Go code](https://blog.golang.org/godoc)
- [ ] updated the relevant documentation or specification - see cosmos#9615
- [x] reviewed "Files changed" and left comments if necessary
- [x] confirmed all CI checks have passed

### Reviewers Checklist

*All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.*

I have...

- [x] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title
- [x] confirmed `!` in the type prefix if API or client breaking change
- [ ] confirmed all author checklist items have been addressed 
- [ ] reviewed state machine logic
- [x] reviewed API design and naming
- [ ] reviewed documentation is accurate - see cosmos#9615
- [ ] reviewed tests and test coverage
- [ ] manually tested (if applicable)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Code Hygiene General cleanup and restructuring of code to provide clarity, flexibility, and modularity.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants