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

Calling deprecated methods – warn? #564

Closed
dvdplm opened this issue Nov 16, 2021 · 3 comments
Closed

Calling deprecated methods – warn? #564

dvdplm opened this issue Nov 16, 2021 · 3 comments

Comments

@dvdplm
Copy link
Contributor

dvdplm commented Nov 16, 2021

Consider an RPC server where some methods are marked as deprecated:

	#[rpc(client, server, namespace = "foo")]
	pub trait Rpc {
		#[method(name = "foo")]
		async fn async_method(&self, param_a: u8, param_b: String) -> RpcResult<u16>;

		#[deprecated(since="0.5.0", note="please use `new_method` instead")]
		#[method(name = "bar")]
		fn sync_method(&self) -> RpcResult<u16>;
       }

Ideally, using the generated Rust client should inform/warn the user when client.sync_method() is called. Preferably at compile time.

e.g. paritytech/substrate#8783 (comment)

@niklasad1
Copy link
Member

That's good idea I like it

lexnv added a commit to lexnv/jsonrpsee that referenced this issue Nov 21, 2021
Calling a deprecated method of the RPC client should warn
the user at compile-time.

Extract the `#[deprecated]` macro as is while parsing the
RpcMethod, and pass through the macro to the RPC client
rendering.
lexnv added a commit to lexnv/jsonrpsee that referenced this issue Nov 21, 2021
To ensure that the test will fail during compilation,
warnings are denied.

Check that the deprecate macro will generate warnings
just for the methods that are utilized.
@lexnv
Copy link
Contributor

lexnv commented Nov 21, 2021

PR for deprecated methods: #570

niklasad1 pushed a commit that referenced this issue Nov 21, 2021
* proc-macros: Fix documentation typo of `rpc_identifier`

* proc-macros: Support deprecated methods for rpc client (#564)

Calling a deprecated method of the RPC client should warn
the user at compile-time.

Extract the `#[deprecated]` macro as is while parsing the
RpcMethod, and pass through the macro to the RPC client
rendering.

* tests/ui: Check deprecated method for rpc client (#564)

To ensure that the test will fail during compilation,
warnings are denied.

Check that the deprecate macro will generate warnings
just for the methods that are utilized.
@niklasad1
Copy link
Member

Closed by #570

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants