apollographql / apollographql/apollo-tooling

Xcode @deprecated not working

Open
#1,356 0 comments 1 reaction 0 assignees View on GitHub
:bird: component - swift :tada: feature 🤖 component - codegen
Dominant language
TypeScript
Stars
3k
Forks
460
PR merge metrics
No merged PRs in 30d

Description

**Intended outcome:**
When properties on a GraphQL db are deprecated they CLI should auto generate Xcode `@deprecated`

**Actual outcome:**
The generated code is not marked with `@deprecated`, but with `/// deprecated`. This does not show a warning to the user.

**How to reproduce the issue:**
Here is a snippet from the schema.json file
```
{
"name": "coverImage",
"description": "Deprecated",
"args": [],
"type": { "kind": "OBJECT", "name": "SignedUrl", "ofType": null },
"isDeprecated": true,
"deprecationReason": "Cover images are not used on tags."
}
```

And the resulting Xcode generated code
```
/// Deprecated
public var coverImage: CoverImage? {
get {
return (resultMap["coverImage"] as? ResultMap).flatMap { CoverImage(unsafeResultMap: $0) }
}
set {
resultMap.updateValue(newValue?.resultMap, forKey: "coverImage")
}
}
```

**Versions**
We're using Xcode 10.2.1 with Apollo 0.10.1 installed via CocoaPods.

Contributor guide

Open the contributing guide

Research direction

Start by tracing the CLI's Swift code generation from the schema.json deprecation fields to the generated property shown in the report. Reproduce the issue with the provided schema snippet and verify that generated Xcode code produces a deprecation warning rather than only a documentation comment.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
mobile-dev, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.