Ash FrameworkAF
Ash Framework3y ago
7 replies
Blibs

GraphQL API fails if custom type is not allowed via a field_policy

I noticed that if I ask my graphQL API to return a field that is forbidden, if the field is built-in, it will just return the field as
null
, all the other fields normally (assuming they are not forbidden as-well) and an error in the errors list telling that this field is forbidden.

But, if I try the same with a custom type, then I just get the full result as null:

{
    "data": {
        "listValidProperties": {
            "results": null
        }
    },
    "errors": [
        {
            "code": "forbidden_field",
            "message": "forbidden field",
            "path": [
                "listValidProperties",
                "results",
                0,
                "price"
            ],
            "fields": [],
            "vars": {},
            "locations": [
                {
                    "line": 5,
                    "column": 4
                }
            ],
            "short_message": "forbidden field"
        }
    ]
}
Was this page helpful?