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 deny_unknown_fields from Request and Response #803

Merged
merged 5 commits into from
Jun 22, 2022

Conversation

tgmichel
Copy link
Contributor

Solves #797

@niklasad1 please let me know if this is prefered over keeping optional deny_unknown_fields behind a feature.

@tgmichel tgmichel requested a review from a team as a code owner June 22, 2022 12:48
Copy link
Member

@niklasad1 niklasad1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good but we should do the same for the Response for consistency.
It's not that likely that other servers impls will add custom fields but better safe than sorry I guess.

I'm happy if we don't have to use more feature flags than necessary :)

@tgmichel tgmichel changed the title Remove deny_unknown_fields from Request Remove deny_unknown_fields from Request and Response Jun 22, 2022
@@ -545,7 +545,7 @@ async fn invalid_request_should_not_close_connection() {
let addr = server().await;
let mut client = WebSocketTestClient::new(addr).with_default_timeout().await.unwrap().unwrap();

let req = r#"{"jsonrpc":"2.0","method":"bar","id":1,"is_not_request_object":1}"#;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we add a quick test just to prove that something like {"jsonrpc":"2.0","method":"bar","id":1,"is_not_request_object":1} is now valid and catch any regresstions?

Copy link
Collaborator

@jsdw jsdw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A test might be nice but not too important, so LGTM :)

@niklasad1 niklasad1 merged commit 18a4449 into paritytech:master Jun 22, 2022
librelois added a commit to PureStake/jsonrpsee that referenced this pull request Aug 16, 2022
…h#803)

* Remove `deny_unknown_fields`

* Update invalid request tests

* Remove `is_not_request_object` field from req in test

* Remove `deny_unknown_fields` from `Response`

* Add test to verify unknown field results in valid request
librelois added a commit to PureStake/jsonrpsee that referenced this pull request Aug 16, 2022
…h#803)

* Remove `deny_unknown_fields`

* Update invalid request tests

* Remove `is_not_request_object` field from req in test

* Remove `deny_unknown_fields` from `Response`

* Add test to verify unknown field results in valid request
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

Successfully merging this pull request may close these issues.

None yet

4 participants