Skip to content

restyFieldNames

PropertyValue
Config namerestyFieldNames
Default severitywarn
ContextSchema
In recommendedNo

Detects fields whose names follow REST-style conventions like getUser, listUsers, or deleteItem. In GraphQL, fields on Query are inherently “getters” and fields on Mutation are inherently actions, so prefixes like get, list, post, put, patch, delete, and fetch are redundant. Removing them leads to a more idiomatic GraphQL API.

# ⚠️ Warning — REST-style prefixes
type Query {
getUser(id: ID!): User
listUsers: [User!]!
fetchPosts: [Post!]!
}
type Mutation {
deleteUser(id: ID!): DeleteUserPayload
postComment(input: CommentInput!): Comment
}
# ✅ Good — idiomatic GraphQL names
type Query {
user(id: ID!): User
users: [User!]!
posts: [Post!]!
}
type Mutation {
removeUser(id: ID!): DeleteUserPayload
createComment(input: CommentInput!): Comment
}
OptionTypeDefaultDescription
prefixesstring[]["get", "list", "post", "put", "patch", "delete", "fetch"]Prefixes to flag as REST-style
# Use default prefixes
extensions:
graphql-analyzer:
lint:
rules:
restyFieldNames: warn
# Customize the prefix list
extensions:
graphql-analyzer:
lint:
rules:
restyFieldNames:
severity: warn
options:
prefixes: ["get", "list", "fetch"]