Open shirados90 opened 2 years ago
Describe the bug Searching by ID field fails if non-numeric string passed as value.
ID
example query:
query GetComponents($projId: ID!) { components(filter: { projectId: { eq: $projId } }) { edges { node { id name } } } } input ComponentFilter { and: [ComponentFilter!] or: [ComponentFilter!] id: IDFilterComparison name: StringFieldComparison projectId: StringFieldComparison project: ComponentFilterProjectFilter }
In query-service a query argument looks like the following:
query
{ filter: { projectId: { eq: NaN } } }
@Entity({ name: 'Component' }) export class ComponentEntity { @PrimaryGeneratedColumn() id: number;
@Column() name: string;
@ManyToOne(() => ProjectEntity, { cascade: true, nullable: false }) project: ProjectEntity;
@Column('uuid') @RelationId((c: ComponentEntity) => c.project) projectId: string; }
@ObjectType('Component') @FilterableRelation('project', () => ProjectDTO, { disableRemove: true, disableUpdate: true, nullable: false }) export class ComponentDTO { @IDField(() => ID) id!: number;
@FilterableField() name!: string;
@IDField(() => ID) projectId!: string; }
To Reproduce
uuid
Expected behavior GQL ID type treated as string, not number.
Desktop (please complete the following information): ` { "name": "smart-flow", "packageManager": "yarn@3.2.4", "dependencies": { "@apollo/client": "^3.7.1", "@emotion/react": "^11.10.5", "@emotion/styled": "^11.10.5", "@fontsource/roboto": "^4.5.8", "@inovua/reactdatagrid-community": "^5.5.0", "@mui/icons-material": "^5.10.9", "@mui/material": "^5.10.12", "@nestjs-query/query-graphql": "^0.30.0", "@nestjs-query/query-typeorm": "^0.30.0", "@nestjs/apollo": "^10.1.4", "@nestjs/common": "^9.1.6", "@nestjs/config": "^2.2.0", "@nestjs/core": "^9.0.0", "@nestjs/graphql": "^10.1.5", "@nestjs/platform-express": "^9.0.0", "@nestjs/typeorm": "^9.0.1", "@reach/menu-button": "^0.18.0", "@reduxjs/toolkit": "^1.8.6", "@tailwindcss/forms": "^0.5.3", "apollo-server-express": "^3.11.1", "class-transformer": "^0.5.1", "class-validator": "^0.13.2", "core-js": "^3.26.0", "dataloader": "^2.1.0", "flowbite": "^1.5.3", "flowbite-react": "^0.3.4", "graphql": "^16.6.0", "graphql-subscriptions": "^2.0.0", "mysql2": "^2.3.3", "react": "^18.2.0", "react-dom": "^18.2.0", "react-icons": "^4.6.0", "react-redux": "^8.0.5", "react-router-dom": "^6.4.2", "reactflow": "^11.2.0", "reflect-metadata": "^0.1.13", "regenerator-runtime": "^0.13.10", "rxjs": "^7.0.0", "typeorm": "^0.3.10" }, "devDependencies": { "@nestjs/schematics": "^9.0.0", "@nestjs/testing": "^9.0.0", "@nrwl/jest": "15.0.9", "@nrwl/linter": "^15.0.4", "@nrwl/nest": "15.0.9", "@nrwl/node": "15.0.9", "@nrwl/nx-cloud": "^15.0.0", "@nrwl/react": "^15.0.4", "@nrwl/webpack": "^15.0.4", "@testing-library/react": "^13.4.0", "@types/jest": "28.1.1", "@types/node": "18.7.1", "@types/react": "^18.0.24", "@types/react-dom": "^18.0.8", "autoprefixer": "10.4.12", "eslint": "^8.26.0", "jest": "28.1.1", "jest-environment-jsdom": "28.1.1", "nx": "^15.0.4", "postcss": "8.4.16", "tailwindcss": "3.1.8", "ts-jest": "28.0.5", "ts-node": "10.9.1", "tslib": "^2.4.0", "typescript": "^4.8.4" } }
`
Describe the bug Searching by
ID
field fails if non-numeric string passed as value.example query:
query GetComponents($projId: ID!) { components(filter: { projectId: { eq: $projId } }) { edges { node { id name } } } } input ComponentFilter { and: [ComponentFilter!] or: [ComponentFilter!] id: IDFilterComparison name: StringFieldComparison projectId: StringFieldComparison project: ComponentFilterProjectFilter }
In query-service a
query
argument looks like the following:{ filter: { projectId: { eq: NaN } } }
@Entity({ name: 'Component' }) export class ComponentEntity { @PrimaryGeneratedColumn() id: number;
@Column() name: string;
@ManyToOne(() => ProjectEntity, { cascade: true, nullable: false }) project: ProjectEntity;
@Column('uuid') @RelationId((c: ComponentEntity) => c.project) projectId: string; }
@ObjectType('Component') @FilterableRelation('project', () => ProjectDTO, { disableRemove: true, disableUpdate: true, nullable: false }) export class ComponentDTO { @IDField(() => ID) id!: number;
@FilterableField() name!: string;
@IDField(() => ID) projectId!: string; }
To Reproduce
uuid
idExpected behavior GQL ID type treated as string, not number.
Desktop (please complete the following information): ` { "name": "smart-flow", "packageManager": "yarn@3.2.4", "dependencies": { "@apollo/client": "^3.7.1", "@emotion/react": "^11.10.5", "@emotion/styled": "^11.10.5", "@fontsource/roboto": "^4.5.8", "@inovua/reactdatagrid-community": "^5.5.0", "@mui/icons-material": "^5.10.9", "@mui/material": "^5.10.12", "@nestjs-query/query-graphql": "^0.30.0", "@nestjs-query/query-typeorm": "^0.30.0", "@nestjs/apollo": "^10.1.4", "@nestjs/common": "^9.1.6", "@nestjs/config": "^2.2.0", "@nestjs/core": "^9.0.0", "@nestjs/graphql": "^10.1.5", "@nestjs/platform-express": "^9.0.0", "@nestjs/typeorm": "^9.0.1", "@reach/menu-button": "^0.18.0", "@reduxjs/toolkit": "^1.8.6", "@tailwindcss/forms": "^0.5.3", "apollo-server-express": "^3.11.1", "class-transformer": "^0.5.1", "class-validator": "^0.13.2", "core-js": "^3.26.0", "dataloader": "^2.1.0", "flowbite": "^1.5.3", "flowbite-react": "^0.3.4", "graphql": "^16.6.0", "graphql-subscriptions": "^2.0.0", "mysql2": "^2.3.3", "react": "^18.2.0", "react-dom": "^18.2.0", "react-icons": "^4.6.0", "react-redux": "^8.0.5", "react-router-dom": "^6.4.2", "reactflow": "^11.2.0", "reflect-metadata": "^0.1.13", "regenerator-runtime": "^0.13.10", "rxjs": "^7.0.0", "typeorm": "^0.3.10" }, "devDependencies": { "@nestjs/schematics": "^9.0.0", "@nestjs/testing": "^9.0.0", "@nrwl/jest": "15.0.9", "@nrwl/linter": "^15.0.4", "@nrwl/nest": "15.0.9", "@nrwl/node": "15.0.9", "@nrwl/nx-cloud": "^15.0.0", "@nrwl/react": "^15.0.4", "@nrwl/webpack": "^15.0.4", "@testing-library/react": "^13.4.0", "@types/jest": "28.1.1", "@types/node": "18.7.1", "@types/react": "^18.0.24", "@types/react-dom": "^18.0.8", "autoprefixer": "10.4.12", "eslint": "^8.26.0", "jest": "28.1.1", "jest-environment-jsdom": "28.1.1", "nx": "^15.0.4", "postcss": "8.4.16", "tailwindcss": "3.1.8", "ts-jest": "28.0.5", "ts-node": "10.9.1", "tslib": "^2.4.0", "typescript": "^4.8.4" } }
`