- Strapi Version: 4.3.9
- Operating System: Node Alpine Docker
- Database: MariaDB
- Node Version: 16
- NPM Version: 7.20.5
- Yarn Version:
I am using GraphQL as my primary API method, which means that it’s convenient to make use of GraphQL codegen to generate types for my frontend. I noticed that there is very likely a bug in the GraphQL schema that’s causing some issues. The
username fields of
UsersPermissionsUser type are type
String!. This doesn’t make sense because this type describes a response, which isn’t required to have any fields at all. The only time anything should be typed as required(!) is inside of GraphQL inputs, no?
It seems perhaps there is some confusion in the
attributes.[fieldname].required attribute, which is used to determine whether the field is required during CREATION of an item, not whether it’s required in the API response.
This causes a headache because I’m frequently passing objects that match the general shape of a
UsersPersmissionsUserEntity into React function component props, except they might be missing an
The same is true for any EntityResponseCollection as well where it says data and meta are required, even though I make requests frequently that don’t request meta: