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

Not able to filter based on boolean and integer values when using generateClient from 'aws-amplify/data' #2524

Closed
sushpatg opened this issue May 2, 2024 · 2 comments
Assignees
Labels
bug Something isn't working data-schema Gen 2

Comments

@sushpatg
Copy link

sushpatg commented May 2, 2024

Environment information

System:
  OS: macOS 14.4.1
  CPU: (8) arm64 Apple M1 Pro
  Memory: 299.08 MB / 16.00 GB
  Shell: /bin/zsh
Binaries:
  Node: 20.11.1 - /opt/homebrew/opt/node@20/bin/node
  Yarn: undefined - undefined
  npm: 10.2.4 - /opt/homebrew/opt/node@20/bin/npm
  pnpm: undefined - undefined
NPM Packages:
  @aws-amplify/backend: 1.0.0
  @aws-amplify/backend-cli: 1.0.1
  aws-amplify: 6.2.0
  aws-cdk: 2.139.1
  aws-cdk-lib: 2.139.1
  typescript: 5.4.5
AWS environment variables:
  AWS_STS_REGIONAL_ENDPOINTS = regional
  AWS_NODEJS_CONNECTION_REUSE_ENABLED = 1
  AWS_SDK_LOAD_CONFIG = 1
No CDK environment variables

Description

I was trying to perform listTodo filtering based on a boolean value and seeing unexpected behaviour where its looking string value for both boolean and Integer fields

  Todo: a
    .model({
      content: a.string(),
      done: a.boolean(),
      count:a.integer(),

      priority: a.enum(['low', 'medium', 'high'])
    })
    .authorization((allow) => [allow.guest()]),
});

Query:

const { data } = await client.models.Todo.list({
      filter:{
        content :{ eq:"test"},
        done:{eq: false},
        count:{eq: 12}
      }
    });

Error :
Type 'boolean' is not assignable to type 'string'
Type 'number' is not assignable to type 'string'

This is not the behavior when using v5r or v6 code of 'aws-amplify/api'

@iartemiev iartemiev transferred this issue from aws-amplify/amplify-backend May 2, 2024
@iartemiev iartemiev added bug Something isn't working Gen 2 data-schema and removed pending-triage labels May 2, 2024
@iartemiev iartemiev self-assigned this May 14, 2024
@iartemiev
Copy link
Contributor

@sushpatg this bug is fixed in the latest version of @aws-amplify/data-schema. Please run npm update @aws-amplify/data-schema to get the patched version.

Copy link

This issue is now closed. Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working data-schema Gen 2
Projects
None yet
Development

No branches or pull requests

2 participants