ariadne-codegen icon indicating copy to clipboard operation
ariadne-codegen copied to clipboard

`[ID!]` type incorrectly treated as a scalar in `custom_queries.py`

Open multimeric opened this issue 10 months ago • 1 comments

An MRE can be found here: https://github.com/multimeric/AriadneCodegenBug.

In summary, a schema such as:

type Query {
  boards(
    ids: [ID!]
  ): [String]
}

Incorrectly produces:

class Query:
    @classmethod
    def boards(cls, *, ids: Optional[str] = None) -> GraphQLField:
        ...

ids should be list[str] or similar, and not a scalar Optional[str].

multimeric avatar Feb 18 '25 06:02 multimeric

BUMP

stivens avatar Mar 31 '25 09:03 stivens

can we have the fix for this in the next release please? thanks

ctnpic avatar Jun 20 '25 08:06 ctnpic

can we have the fix for this in the next release please? thanks

https://github.com/mirumee/ariadne-codegen/pull/363 You have to build locally the branch above and use the snapshot version. This repository is kinda abandoned

stivens avatar Jun 20 '25 09:06 stivens

@stivens thanks for getting back. does this mean this package will not have any further support going forward? thank you

ctnpic avatar Jun 20 '25 09:06 ctnpic

I dont know. I cant know

stivens avatar Jun 20 '25 09:06 stivens

Hi, it is fixed in the 0.16.0 version. It will generate function code like: def boards(cls, *, ids: Optional[List[str]] = None) -> GraphQLField:

DamianCzajkowski avatar Oct 23 '25 11:10 DamianCzajkowski