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

Deprecate the serde module #138

Merged
merged 6 commits into from
Jun 20, 2024
Merged

Conversation

timvisee
Copy link
Member

This deprecates the serde module and the PayloadConversionError.

Instead, this now recommends to use Payload::from_json_object(value) -> Option<Payload>. It seems to make more sense, and doesn't require a custom error type.

This also adds more useful conversion. For example, to convert form serde_json::Map (a JSON object) into Payload because this cannot fail.

All Submissions:

  • Contributions should target the dev branch. Did you create your branch from dev?
  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?

New Feature Submissions:

  1. Does your submission pass tests?
  2. Have you formatted your code locally using cargo +nightly fmt --all command prior to submission?
  3. Have you checked your code using cargo clippy --all --all-features command?

@JojiiOfficial
Copy link
Contributor

I just found it being used in the snippets.
Might be a bit long to always type Payload::from_json_object(json!({ ... })).unwrap(). What do you think?

@timvisee
Copy link
Member Author

timvisee commented Jun 20, 2024

Might be a bit long to always type Payload::from_json_object(json!({ ... })).unwrap(). What do you think?

Do you have another (name) suggestion to improve on this? A custom error like we had doesn't really follow the mantra we have with our general Error. Also, the error type does not add any more useful information than None does.

I'll merge this one now, but let's keep the above in mind and improve where we can.

@timvisee timvisee merged commit 6b7b73c into v1-10-upgrade Jun 20, 2024
2 checks passed
timvisee added a commit that referenced this pull request Jun 26, 2024
* Deprecate serde module

* Rename errors to error

* Add more payload conversion functions

* Update documentation

* Allow deprecated usage in serde tests

* Move serde tests, fix deprecation warning
timvisee added a commit that referenced this pull request Jun 26, 2024
* Deprecate serde module

* Rename errors to error

* Add more payload conversion functions

* Update documentation

* Allow deprecated usage in serde tests

* Move serde tests, fix deprecation warning
timvisee added a commit that referenced this pull request Jun 27, 2024
* Deprecate serde module

* Rename errors to error

* Add more payload conversion functions

* Update documentation

* Allow deprecated usage in serde tests

* Move serde tests, fix deprecation warning
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

2 participants