ra-data-opencrud
Version:
A Prisma/GraphCMS data provider for react-admin
16 lines (12 loc) • 335 B
text/typescript
import {
TypeKind,
IntrospectionTypeRef,
IntrospectionListTypeRef
} from 'graphql';
const isRequired = (type: IntrospectionTypeRef): boolean => {
if (type.kind === TypeKind.LIST) {
return isRequired((type as IntrospectionListTypeRef).ofType!);
}
return type.kind === TypeKind.NON_NULL;
};
export default isRequired;