rexxars / sql-to-graphql

Generate a GraphQL API based on your SQL database structure
MIT License
592 stars 73 forks source link

Required fields #46

Open simakwm opened 7 years ago

simakwm commented 7 years ago

I hava a table described like this: type City { id: Int! name: String! }

Well, if I want to query all cities I should do: query test{ city { name } }

But I got this error: Field "city" argument "id" of type "Int!" is required but not provided.

So I was thinking if is there a way to list all cities instead of only one.

miguelalvarado commented 7 years ago

any progress on this?

simakwm commented 7 years ago

Nope. :(

miguelalvarado commented 7 years ago

Hi @simakwm ,

have you checked the Schema, the ids are created like this : id: { name: 'id', type: new GraphQLNonNull(GraphQLInt) }

So your query could be : query test{ city { id:1 } }

Have you tried to query by id?

simakwm commented 7 years ago

Not yet. In fact gave up trying to use graphql for now.