Skip to content

Schema introspection can't handle List of Strings type #1140

@anton-kazlouski

Description

@anton-kazlouski

I've been trying to add a parameter for filtration. It should be a list of string values.
Ideally, I would like to use django_filters.ModelMultipleChoiceFilter but graphene recognize it as a List of IDs which is not what I expect. But even if I try to use this, I'll receive validation errors.

 assigned_turnovers = DjangoFilterConnectionField(
        types.Turnover,
        project_id=graphene.SmartID(),
        id=graphene.SmartID(),
        filterset_class=filters.turnover.TurnoverFilter,
    )
class TurnoverFilter(BaseFilter):
    task_shot_bid_status = django_filters.CharFilter(field_name="task_shots__bids__status")

schema.json

               {
                  "defaultValue": null,
                  "description": null,
                  "name": "taskShotBidStatus",
                  "type": {
                    "kind": "LIST",
                    "name": null,
                    "ofType": {
                      "kind": "SCALAR",
                      "name": "ID",
                      "ofType": null
                    }
                  }
                },

Screen Shot 2020-02-21 at 20 56 15

Screen Shot 2020-02-21 at 20 56 43

On the screenshots you can see that the errors contradict each other.

OK, what if I try to define a parameter in DjangoFilterConnectionField?

 assigned_turnovers = DjangoFilterConnectionField(
        types.Turnover,
        project_id=graphene.SmartID(),
        id=graphene.SmartID(),
        list_of_strings=graphene.List(graphene.String),
        filterset_class=filters.turnover.TurnoverFilter,
    )

schema.json

                {
                  "defaultValue": null,
                  "description": null,
                  "name": "listOfStrings",
                  "type": {
                    "kind": "LIST",
                    "name": null,
                    "ofType": {
                      "kind": "SCALAR",
                      "name": "String",
                      "ofType": null
                    }
                  }
                },

Screen Shot 2020-02-21 at 21 08 30

Screen Shot 2020-02-21 at 21 08 46

As you can see the same errors.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions