Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Mutation type #33

Open
rafalp opened this issue Nov 21, 2023 · 1 comment
Open

Support Mutation type #33

rafalp opened this issue Nov 21, 2023 · 1 comment
Assignees
Labels
next-api Support for both code and schema first approaches prio: low Low priority roadmap
Milestone

Comments

@rafalp
Copy link
Contributor

rafalp commented Nov 21, 2023

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.

@rafalp rafalp added next-api Support for both code and schema first approaches prio: low Low priority labels Nov 21, 2023
@rafalp rafalp added this to the Next API milestone Nov 21, 2023
@rafalp rafalp self-assigned this Nov 21, 2023
@rafalp rafalp added prio: med Medium priority roadmap and removed prio: low Low priority labels Apr 25, 2024
@rafalp rafalp mentioned this issue Apr 25, 2024
12 tasks
@DamianCzajkowski DamianCzajkowski added prio: low Low priority and removed prio: med Medium priority labels Aug 19, 2024
@DamianCzajkowski
Copy link

This can be delayed after next API is released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
next-api Support for both code and schema first approaches prio: low Low priority roadmap
Projects
None yet
Development

No branches or pull requests

2 participants