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

fix: fix serialization of InlineQueryResult #230

Merged
merged 10 commits into from
Nov 26, 2024

Conversation

ayrat555
Copy link
Owner

No description provided.

@ayrat555 ayrat555 requested a review from EdJoPaTo November 22, 2024 08:34
@ayrat555 ayrat555 mentioned this pull request Nov 22, 2024
@@ -22,6 +22,7 @@ async-telegram-trait = ["dep:async-trait"]

[lints.rust]
unsafe_code = "forbid"
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(rust_analyzer)'] }
Copy link
Owner Author

Choose a reason for hiding this comment

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

image

Copy link
Collaborator

Choose a reason for hiding this comment

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

@Veetaha might interest this. There is also elastio/bon#212 which might be similar / related. 👀

Copy link
Contributor

@Veetaha Veetaha Nov 22, 2024

Choose a reason for hiding this comment

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

This is a regression on nightly only. It was worked around in a 3.0.2 version. I think you can upgrade to this version without a migration

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this should be its own PR?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, there is a dependabot PR #229

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this should be its own PR?

To extend to that, this only fails on nightly so I would just ignore this for this PR and remove this change. A bon patch is there, and I could also see rust_analyzer being added to the list of well known values. So a change in this repo seems in the wrong place either way.

Comment on lines 85 to 90
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
#[serde(untagged)]
pub enum InlineQueryResultAudioOrCachedAudio {
CachedAudio(InlineQueryResultCachedAudio),
Audio(InlineQueryResultAudio),
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

This seems like a bunch of repetition 🤔

But also not that much that a macro might be really worth it. Can there be a generic type? Is that useful?

Copy link
Owner Author

Choose a reason for hiding this comment

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

I think it makes. but I will be able to experiment on this only on weekend. you can push to this pr as well

Copy link
Owner Author

Choose a reason for hiding this comment

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

@EdJoPaTo actually creating enum was easier than I thought. It seems you don't have to provide types for generics in enum 🤔

Copy link
Collaborator

Choose a reason for hiding this comment

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

I like the Either enum! Just not entirely sure how well it can be used in code. It also shows up randomly in the docs with not much docs so its kinda vague… Maybe naming it MaybeCached or something to clear up the intention of it?

Generally its used when creating the inline query results to be shown so the user knows whether its cached or not and picks one of them. So they know which struct to pick. Not sure how to improve the handling of that. Maybe with Into?

src/api_params.rs Outdated Show resolved Hide resolved
@ayrat555 ayrat555 requested a review from EdJoPaTo November 22, 2024 13:59
src/api_params.rs Outdated Show resolved Hide resolved
src/api_params.rs Outdated Show resolved Hide resolved
ayrat555 and others added 4 commits November 26, 2024 20:56
Co-authored-by: EdJoPaTo <rfc-conform-git-commit-email@funny-long-domain-label-everyone-hates-as-it-is-too-long.edjopato.de>
Co-authored-by: EdJoPaTo <rfc-conform-git-commit-email@funny-long-domain-label-everyone-hates-as-it-is-too-long.edjopato.de>
@ayrat555 ayrat555 merged commit 1a6b10f into master Nov 26, 2024
56 checks passed
@ayrat555 ayrat555 deleted the ayrat555/fix-inline-query-result branch November 26, 2024 19:28
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.

3 participants