You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import{InputType,Int,Field}from'@nestjs/graphql';
@InputType()exportclassCreateExampleInput{
@Field(()=>Int,{description: 'Example field (placeholder)',deprecationReason: 'This field is deprecated',})exampleField: number;}
Run app
npm run start:dev
Check src/schema.gql file (no deprecated directive)
inputCreateExampleInput {
"""Example field (placeholder)"""exampleField: Int!
}
Expected behavior
exampleField is deprecated in GraphQL schema
inputCreateExampleInput {
"""Example field (placeholder)"""exampleField: Int!@deprecated(reason: "This field is deprecated")
}
@kamilmysliwiec@Deniks Could you state for my understanding why this has been closed? As far as I understand the linked thread, this PR has been merged: graphql/graphql-spec#525 Therefore, deprecation of input types should be possible. Otherwise, I am getting something totally wrong.
I have checked today against the latest version in conjunction with this fix: nestjs/graphql#3157 (Adding deprecation to Args). However, the code-first approach (using InputType as shown above as well), still does not support this.
Is there an existing issue for this?
Current behavior
deprecationReason
property in InputType decodarot does not deprecate field in GraphQL schemaMinimum reproduction code
https://github.com/Oleshkooo/nestjs-field-deprecation-issue
Steps to reproduce
Create new nest project
nest new .
Install packages
npm i @nestjs/graphql @nestjs/apollo @apollo/server graphql
Edit app.module.ts
Generate new module
Edit src/example/dto/create-example.input.ts
Run app
npm run start:dev
Check src/schema.gql file (no deprecated directive)
Expected behavior
exampleField
is deprecated in GraphQL schemaPackage
@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.1.18 (nest -v)
Packages versions
Node.js version
20.11.0
In which operating systems have you tested?
Other
From the docs:
WARNING
Directives applied through the @directive() decorator will not be reflected in the generated schema definition file.
So I didn't use @directive()
OS: MacOS
Version: Sonoma 14.1.1
Node.js version: 20.11.0
npm version: 10.2.4
NestJS version: 10.1.18 (
nest -v
)The text was updated successfully, but these errors were encountered: