Open ragingsquirrel3 opened 2 years ago
Hey @ragingsquirrel3 :wave: thanks for raising this and by providing those reproduction steps and details! I was able to successfully reproduce this behavior and observed the input type is created as follows:
input ModelSizeInput {
ne: Int
eq: Int
le: Int
lt: Int
ge: Int
gt: Int
between: [Int]
}
Marking as a bug 🙂
Before opening, please confirm:
How did you install the Amplify CLI?
npm
If applicable, what version of Node.js are you using?
v12.19.1
Amplify CLI Version
8.0.2
What operating system are you using?
mac
Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.
no manual changes made to reproduce
Amplify Categories
api
Amplify Commands
add
Describe the bug
When I create a GraphQL backend using a schema with a enums, the compiled schema includes filters which can be used to run queries with filters. For enum fields, the compiled schema for the filter type of "eq" and other operations is an Int. It's not clear how I can filter for items where e.g. size == 'SMALL' as the request will only accept an integer value.
a schema like
compiles with a
listBlogs
operation that acceptsModelBlogFilterInput
and thesize
argument is of typeModelInputSize
and all theeq
,le
, etc... operators are of typeInt
. I could not query it in the appsync console using any int. When I manually changed the compiled schema to Strings foreq
I was able to filter by "SMALL."This arose while investigating amplify-flutter issue https://github.com/aws-amplify/amplify-flutter/issues/1567 and I found I could not do the expected query in the appsync console so was not clear how to fix in amplify-flutter.
Expected behavior
The
ModelInputSize
operation should have String for all the eq, ge, etc... operators. Or there should be some way to filter by a string.Reproduction steps
amplify init
amplify add api
, use gql, api key, for schema use, see belowamplify push --yes
You will have to pass an int.
Expected: you can pass a string
GraphQL schema(s)
Log output
Additional information
No response