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

Parsing issue with CreateInvoiceAutomaticTaxLiabilityType #489

Closed
WieslerTNG opened this issue Jan 29, 2024 · 3 comments · Fixed by #490
Closed

Parsing issue with CreateInvoiceAutomaticTaxLiabilityType #489

WieslerTNG opened this issue Jan 29, 2024 · 3 comments · Fixed by #490
Labels
bug Something isn't working

Comments

@WieslerTNG
Copy link

Describe the bug

Parsing a webhook invoice event throws an error:

BadParse(Error("unknown variant `self`, expected `account` or `self_`", line: XX, column: XX))

To Reproduce

Minimal reproducing example:

use stripe::CreateInvoiceAutomaticTaxLiability;

#[test]
fn test() {
    let _: CreateInvoiceAutomaticTaxLiability = serde_json::from_str(r#"{ "type": "self" }"#).unwrap();
}

Fails with Error("unknown variant self, expected accountorself_", line: 1, column: 16)

Expected behavior

No error

Code snippets

The problem is in the following lines.


/// An enum representing the possible values of an `CreateInvoiceAutomaticTaxLiability`'s `type` field.
#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum CreateInvoiceAutomaticTaxLiabilityType {
    Account,
>   // Probable fix: Add this
>   #[serde(rename = "self")]
    Self_,
}


### OS

Linux

### Rust version

1.75.0

### Library version

0.31.0

### API version

2023-10-16

### Additional context

_No response_
@WieslerTNG WieslerTNG added the bug Something isn't working label Jan 29, 2024
@WieslerTNG
Copy link
Author

Ok I have a fix, I'm creating a MR.

@Sandvoxel
Copy link

Is there a workaround for this issue until the changes from the listed cr's get merged?

@jwiesler
Copy link
Collaborator

No, not as far as I know.

I'd appreciate some feedback from @arlyon on the mr :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants