Skip to content

Attribute #[allow(non_camel_case_types)] for enums #330

Open
@acelot

Description

@acelot

My graphql scheme contains enums with capital letters values and graphql-client cli generates such code:

#[derive(Eq, PartialEq)]
pub enum PagesSortType {
    #[doc = ""]
    ID_ASC,
    #[doc = ""]
    ID_DESC,
    #[doc = ""]
    MODIFIED_AT_ASC,
    #[doc = ""]
    MODIFIED_AT_DESC,
    Other(String),
}

Rust compiler throws warnings:

warning: variant `MODIFIED_AT_DESC` should have an upper camel case name
   --> src/services/pages.rs:417:9
    |
417 |         MODIFIED_AT_DESC,
    |         ^^^^^^^^^^^^^^^^ help: convert the identifier to upper camel case: `ModifiedAtDesc`

Perhaps it’s worth adding an #[allow(non_camel_case_types)] attribute for all enums or making it possible to specify which attributes you want to add yourself via cli argument --variables-attributes for example.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions