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

Confusing snake case behaviour #317

Open
nevoodoo opened this issue Sep 24, 2024 · 0 comments
Open

Confusing snake case behaviour #317

nevoodoo opened this issue Sep 24, 2024 · 0 comments

Comments

@nevoodoo
Copy link

nevoodoo commented Sep 24, 2024

Hi!

Just want to say amazing work with the project, and thank you for the Custom Operations, it has been a life saver indeed.

I wanted to get some clarity on an issue we recently noticed:

@strawberry.field
    async def ourdna_dashboard(
        self, info: Info, root: 'Project'
    ) -> 'GraphQLOurDNADashboard':
        connection = info.context['connection']
        ourdna_layer = OurDnaDashboardLayer(connection)
        if not root.id:
            raise ValueError('Project must have an id')
        ourdna_dashboard = await ourdna_layer.query(project_id=root.id)
        # pylint: disable=no-member
        return GraphQLOurDNADashboard.from_internal(ourdna_dashboard)

If this is the field definition, the resulting codegen client has the field as ourdna_dashboard:

@classmethod
    def ourdna_dashboard(cls) -> "GraphQLOurDNADashboardFields":
        return GraphQLOurDNADashboardFields("ourdna_dashboard")

whereas Strawberry expects it as ourdnaDashboard and so the error on the server is:

raise GraphQLClientGraphQLMultiError.from_errors_dicts(
graphql_client.exceptions.GraphQLClientGraphQLMultiError: Cannot query field 'ourdna_dashboard' on type 'GraphQLProject'. Did you mean 'ourdnaDashboard'?)

Happy to help and push a fix PR if I can be nudged in the right direction :)

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

No branches or pull requests

1 participant