Thanks to visit codestin.com
Credit goes to github.com

Skip to content

#[serde(borrow)] attribute is applied inconsistently #210

@datdenkikniet

Description

@datdenkikniet

The #[serde(borrow)] attribute is a per-variant field.

However, it seems to be applied incorrectly/inconsistently by the code generated by the type-generator. I am not sure if I'm missing a nuance here, but to illustrate:

pub enum Schema<'a> {
    #[serde(borrow = "'a")]
    BranchProtectionRuleEvent(BranchProtectionRuleEvent<'a>), // only the first variant has the `#[serde(borrow)]` attribute.
    CheckRunEvent(CheckRunEvent<'a>),
    ....
}

pub enum BranchProtectionRuleEvent<'a> {
    #[serde(borrow = "'a")]
    Created(BranchProtectionRuleCreatedEvent<'a>), // Again, only this variant has the `[serde(borrow)]` attribute
    Deleted(BranchProtectionRuleDeletedEvent<'a>),
    Edited(BranchProtectionRuleEditedEvent<'a>),
}

pub enum CheckRunEvent<'a> {
    #[serde(borrow = "'a")]
    Completed(CheckRunCompletedEvent<'a>), // This has the borrow attribute, but the parent in Schema does not
    Created(CheckRunCreatedEvent<'a>),
    RequestedAction(CheckRunRequestedActionEvent<'a>),
    Rerequested(CheckRunRerequestedEvent<'a>),
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions