Skip to content

Generate Mutation input from Model #212

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

Closed
Rafik-Belkadi opened this issue May 9, 2019 · 3 comments
Closed

Generate Mutation input from Model #212

Rafik-Belkadi opened this issue May 9, 2019 · 3 comments

Comments

@Rafik-Belkadi
Copy link

Rafik-Belkadi commented May 9, 2019

Is there a way to have something like this ?

class AddUserInput(SQLAlchemyInputObjectType):
    class Meta:
        model = UserModel
@jnak
Copy link
Collaborator

jnak commented May 9, 2019

Not at the moment. If you're interested in contributing to this, feel free to start a design conversation outlining your approach. Cheers.

@jnak jnak closed this as completed May 9, 2019
@thejcannon
Copy link

FWIW I've started basing my mutations off methods in my model, with the hopes that they will be automagically generated leveraging Python 3.6 typing to handle argument generation in the future.

class MyModel(Base):
   # ... fields

   def create(self, foo: String, bar:Optional[String] = None):
      # ...

# would imply

class CreateMyModel(graphene.Mutation):
   class Arguments:
      foo = graphene.String(required=True)
      bar = graphene.String()

   myModel = # node for my model

   def mutate(self, info, **kwargs):
      return CreateMyModel(myModel=MyModel.create(**kwargs))

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related topics referencing this issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants