Skip to content
This repository was archived by the owner on Jan 7, 2026. It is now read-only.
This repository was archived by the owner on Jan 7, 2026. It is now read-only.

Support Mutation type #33

@rafalp

Description

@rafalp

While mutations are already possible in future API via MutationType(ObjectType) sublclassing, we could also have extra MutationType base class that would represent single field on mutation:

class ErrorType(GraphQLObject):
  path: str
  code: str


class LoginMutation(MutationType):
    token: str | None
    errors: List[ErrorType] | None

    def __mutation__(_, info, username: str, password: str) -> LoginMutation:
        return LoginMutation(token="dsa87dsa98798sda")

Result:

type Mutation {
  login(username: String!, password: String!): LoginMutation!
}

type LoginMutation {
  token: String!
  errors: [ErrorType!]
}

type ErrorType {
  path: String!
  code: String!
}

We could use __graphql_name__ to rename LoginMutation to something else in schema, and have extra attr named __mutation_name__ to rename login on Mutation type to something else.

Metadata

Metadata

Labels

next-apiSupport for both code and schema first approachesprio: lowLow priorityroadmap

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions