maoosi/prisma-appsync

Issue: All fields with `@default(xxx)` should be optional in GraphQL Schema

Tenrys opened this issue · 1 comments

Tenrys commented

I would expect to be able to omit required fields that have a default value entirely, so that the database can fill them up for me if I choose not to specify them, but it looks like a field is only considered "auto-populated" under very specific conditions:

private isFieldAutoPopulated(searchField: DMMF.Field): boolean {
const defaultValue: any = searchField?.default || null
return (
defaultValue?.name === 'autoincrement'
|| defaultValue?.name === 'uuid'
|| defaultValue?.name === 'cuid'
|| searchField.isUpdatedAt
|| ['updatedAt', 'createdAt'].includes(searchField.name)
)
}

Shouldn't it just be flagged as such as long as it has a valid @default attributes?

maoosi commented

Will be release as part of 1.0.0-rc.6.