Optional Class Properties Not Reflected in GraphQL Schema When Using SWC Builder #14351
Open
3 of 15 tasks
Labels
needs triage
This issue has not been looked into
Is there an existing issue for this?
Current behavior
When generating a schema from a model using
@ObjectType
, if swc is specified as the builder in nestjs-cli.json, the id property does not become nullable in the schema.However, with no builder specified, the id property becomes nullable with the above definition.
Minimum reproduction code
https://github.com/maronnjapan/test-nestjs-graphql-in-swc
Steps to reproduce
Expected behavior
When switching to the swc builder, we expect the generated schema to remain the same as the default one.
Even if it changes, we would like to understand why the behavior differs when switching to the swc builder.
Package
@nestjs/common
@nestjs/core
@nestjs/microservices
@nestjs/platform-express
@nestjs/platform-fastify
@nestjs/platform-socket.io
@nestjs/platform-ws
@nestjs/testing
@nestjs/websockets
Other package
@nestjs/graphql
NestJS version
10.4.15
Packages versions
{
"scripts": {
"build": "nest build",
"start": "nest start",
"start:dev": "nest start --watch",
"start:debug": "nest start --debug --watch",
"start:prod": "node dist/main",
},
"dependencies": {
"@nestjs/common": "^10.0.0",
"@nestjs/core": "^10.0.0",
"@nestjs/graphql": "^12.2.2",
"@nestjs/mercurius": "^12.2.2",
"@nestjs/platform-express": "^10.0.0",
"@nestjs/platform-fastify": "^10.4.15",
"graphql": "^16.10.0",
"reflect-metadata": "^0.2.0",
"rxjs": "^7.8.1"
},
"devDependencies": {
"@nestjs/cli": "^10.0.0",
"@nestjs/schematics": "^10.0.0",
"@nestjs/testing": "^10.0.0",
"@swc/cli": "^0.5.2",
"@swc/core": "^1.10.1",
"@types/express": "^4.17.17",
"@types/jest": "^29.5.2",
"@types/node": "^20.3.1",
"@types/supertest": "^6.0.0",
"@typescript-eslint/eslint-plugin": "^8.0.0",
"@typescript-eslint/parser": "^8.0.0",
"eslint": "^8.42.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-prettier": "^5.0.0",
"jest": "^29.5.0",
"prettier": "^3.0.0",
"source-map-support": "^0.5.21",
"supertest": "^7.0.0",
"ts-jest": "^29.1.0",
"ts-loader": "^9.4.3",
"ts-node": "^10.9.1",
"tsconfig-paths": "^4.2.0",
"typescript": "^5.1.3"
},
}
Node.js version
20.11.1
In which operating systems have you tested?
Other
The nest-cli.json in the sample project is as follows:
The text was updated successfully, but these errors were encountered: