Skip to content

strictIdInTypes

PropertyValue
Config namestrictIdInTypes
Default severity
ContextSchema
In recommendedNo

Require ID field in object types.

# ❌ Bad — object type without ID field
type User {
name: String
email: String
}
# ✅ Good — object type with ID field
type User {
id: ID!
name: String
email: String
}
OptionTypeDefaultDescription
acceptedIdNamesstring[]["id"]Field names that satisfy the unique identifier requirement.
acceptedIdTypesstring[]["ID"]GraphQL types (non-null) that are accepted as the identifier field’s type.
exceptionsobject{}Types or type-name suffixes to exclude from this rule.
exceptions.typesstring[][]Exact type names to skip (e.g. ["Error", "PageInfo"]).
exceptions.suffixesstring[][]Type-name suffixes to skip — any type whose name ends with one of these is excluded (e.g. ["Payload", "Connection"]).
extensions:
graphql-analyzer:
lint:
rules:
strictIdInTypes: warn
# Accept _id as well as id, allow UUID type, and skip payload types
strictIdInTypes:
- warn
- acceptedIdNames: ["id", "_id"]
acceptedIdTypes: ["ID", "UUID"]
exceptions:
types: ["Error"]
suffixes: ["Payload", "Connection"]