Skip to content
New issue

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

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

Already on GitHub? # to your account

Why not Input Types? #84

Open
frederikhors opened this issue Dec 31, 2019 · 4 comments
Open

Why not Input Types? #84

frederikhors opened this issue Dec 31, 2019 · 4 comments
Labels
BC Breaking Change Enhancement

Comments

@frederikhors
Copy link

I need to understand why using the db.js example file from Readme it doesn't generate the input PostInput or input UserInput or input CommentInput.

Example:

I think it is better to use something like this:

createPost(id: ID!, input: PostInput!): Post

instead of what is now generated:

createPost(id: ID!, title: String!, views: Int!, user_id: ID!): Post.

Am I wrong? I'm still learning... I'm asking for hints. Thanks.

@mbaroukh
Copy link

I agree it would be nice to use be able to extend a common inputType for all List method parameter of entities.

@Kmaschta
Copy link
Contributor

This is a good idea, and it's closer to the real usage of GraphQL nowadays.
But that will be a breaking change, so, let's keep that idea for later!

@Kmaschta Kmaschta added this to the 3.0 milestone Apr 22, 2020
@M1chaelTran
Copy link

I did this and a little more on my fork if anyone is interested.
Feel free to take whatever you need since my changes are breaking changes and I didn't bother to update the test or documentation.
M1chaelTran@b352efe

Changes include:

  • Generate of Input type for each entity
  • Update now takes an id and input of entity input type
  • Made all create and update input fields optional (since this is a test/mock API, it is more convenient to have everything optional)
  • Remove all prefix from Queries (this it is what I need for my project, so feel free to ignore this)

@slax57 slax57 added the BC Breaking Change label Jul 4, 2022
@draqist
Copy link

draqist commented Jul 10, 2022

@M1chaelTran Do you know if there's a way i can achieve this in my own project, I'm taking an assessment for a job and i'd like to be able to pass variables as inputs to the query to use them as filter methods.
Is there a way i can achieve this @slax57 ?

@fzaninotto fzaninotto removed this from the 3.0 milestone Apr 18, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
BC Breaking Change Enhancement
Projects
None yet
Development

No branches or pull requests

7 participants