amplify-codegen icon indicating copy to clipboard operation
amplify-codegen copied to clipboard

`amplify codegen` Ignores `@deprecated` Directive In GraphQL Schema

Open tsuyuni opened this issue 1 year ago β€’ 2 comments

Is this feature request related to a new or existing Amplify category?

api

Is this related to another service?

AppSync

Describe the feature you'd like to request

When I made some fields deprecated by adding @deprecated directive in schema.graphql, these deprecations are ignored in autogenerated src/API.ts file.

For example,

type ToDo @model {
  id: ID!
  name: String!
  due: String! @deprecated(reason: "use dueDate instead")
  dueDate: AWSDateTime!
}

turns into this

export type ToDo = {
  __typeName: "ToDo";
  id: string;
  name: string;
  due: string;
  dueDate: string;
  createdAt: string;
  updatedAt: string;
};

though I hope like this.

export type ToDo = {
  __typeName: "ToDo";
  id: string;
  name: string;
  /** @deprecated use dueDate instead */
  due: string;
  dueDate: string;
  createdAt: string;
  updatedAt: string;
};

In the current situation, we can't notice the use of deprecated fields so that unexpected deletion of field might occur. Are there any alternative solution for this? If not, I strongly hope the implementation of this feature.

Describe the solution you'd like

Explicit marker of deprecated fields.

Describe alternatives you've considered

Nothing especially.

Additional context

No response

Is this something that you'd be interested in working on?

  • [ ] πŸ‘‹ I may be able to implement this feature request

Would this feature include a breaking change?

  • [ ] ⚠️ This feature might incur a breaking change

tsuyuni avatar Aug 13 '24 12:08 tsuyuni

HeyπŸ‘‹ thanks for raising this! I'm going to transfer this over to our API repository for better assistance πŸ™‚

ykethan avatar Aug 13 '24 19:08 ykethan

Hi @tsuyuni, we do not support @deprecated directive. Marking this as a feature request.

phani-srikar avatar Aug 19 '24 01:08 phani-srikar