aws-amplify / aws-amplify/amplify-codegen

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

Open
#863 2 comments 0 reactions 0 assignees View on GitHub
feature-request transferred
Dominant language
TypeScript
Stars
59
Forks
64
PR merge metrics
No merged PRs in 30d

Description

### 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,

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

turns into this

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

though I hope like this.

```typescript
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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.