Skip to content

Commit

Permalink
Updated 1.3 migration guide to include Reserved Keyword change (#3072)
Browse files Browse the repository at this point in the history
  • Loading branch information
BobaFetters authored Jun 14, 2023
1 parent 9f48589 commit 2ba71de
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions docs/source/migrations/1.3.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,53 @@ chain.proceedAsync(
completion: completion
)
```
## Reserved Keyword Type Name Suffxing

When using certain keywords as the name of a GraphQL type the generated code would fail to compile, as a result we decided to enforce the same reserved keyword list already being used for a Selection Set to the following other GraphQL types:

- Custom Scalar
- Enum
- Fragment
- Input Object
- Interface
- Object
- Union

Names for these types will be checked (case insensitive) against the following reserved list:

- ``Any``
- ``DataDict``
- ``DocumentType``
- ``Fragments``
- ``FragmentContainer``
- ``ParentType``
- ``Protocol``
- ``Schema``
- ``Selection``
- ``Self``
- ``String``
- ``Bool``
- ``Int``
- ``Float``
- ``Double``
- ``ID``
- ``Type``
- ``Error``
- ``_``

If a reserved keyword is found it will have its type name suffixed based on the type it represents, take the following Enum example:

```graphql title="Enum Example"
enum Type {
valueOne
valueTwo
}
```

This would result in a generated Swift enum that looks like this:

```swift title="Generated Enum"
enum Type_Enum: String, EnumType
```

Not all of the reserved keywords listed cause a compilation error, however we felt it best to apply suffixing to all of them. This could result in some minor breaking changes to your generated code if you are currently using any of the listed reserved keywords and will require you to update their usage to the new suffixed name.

0 comments on commit 2ba71de

Please sign in to comment.