Skip to content

Commit

Permalink
Add examples in README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
ndejaco2 committed Oct 6, 2023
1 parent 22dcbe3 commit 378a5ff
Show file tree
Hide file tree
Showing 2 changed files with 147 additions and 3 deletions.
144 changes: 142 additions & 2 deletions hooks/AppSync_BreakingChangeDetection/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,147 @@ aws cloudformation set-type-configuration \
--type-name AwsCommunity::AppSync::BreakingChangeDetection
```

## Original Template Example
## Examples

##
- Original Template:

```
Resources:
BasicGraphQLApi:
Type: "AWS::AppSync::GraphQLApi"
Properties:
Name: BasicApi
AuthenticationType: "AWS_IAM"
BasicGraphQLSchema:
Type: "AWS::AppSync::GraphQLSchema"
Properties:
ApiId: !GetAtt BasicGraphQLApi.ApiId
Definition: |
type Test {
version: String!
type: TestType
}
type Query {
getTests: [Test]!
}
type Mutation {
addTest(version: String!): Test
}
enum TestType {
SIMPLE,
COMPLEX
}
```
### Non-Breaking Change Example

- Adding the new field Test.name is not a breaking change.

```
Resources:
BasicGraphQLApi:
Type: "AWS::AppSync::GraphQLApi"
Properties:
Name: BasicApi
AuthenticationType: "AWS_IAM"
BasicGraphQLSchema:
Type: "AWS::AppSync::GraphQLSchema"
Properties:
ApiId: !GetAtt BasicGraphQLApi.ApiId
Definition: |
type Test {
version: String!
type: TestType
name: String
}
type Query {
getTests: [Test]!
getTest(version: String): Test
}
type Mutation {
addTest(version: String!): Test
}
enum TestType {
SIMPLE,
COMPLEX
}
```

### Breaking Change Example

- Removing the Query.getTest field is a breaking change because clients will no longer be able to query it.
```
Resources:
BasicGraphQLApi:
Type: "AWS::AppSync::GraphQLApi"
Properties:
Name: BasicApi
AuthenticationType: "AWS_IAM"
BasicGraphQLSchema:
Type: "AWS::AppSync::GraphQLSchema"
Properties:
ApiId: !GetAtt BasicGraphQLApi.ApiId
Definition: |
type Test {
version: String!
type: TestType
}
type Query {
getTests: [Test]!
}
type Mutation {
addTest(version: String!): Test
}
enum TestType {
SIMPLE,
COMPLEX
}
```

### Dangerous Change Example

- Adding an Enum Value to an existing enum type is considered a "Dangerous" change as it may require changes to handling on the client. It will not break existing queries.
```
Resources:
BasicGraphQLApi:
Type: "AWS::AppSync::GraphQLApi"
Properties:
Name: BasicApi
AuthenticationType: "AWS_IAM"
BasicGraphQLSchema:
Type: "AWS::AppSync::GraphQLSchema"
Properties:
ApiId: !GetAtt BasicGraphQLApi.ApiId
Definition: |
type Test {
version: String!
type: TestType
name: String
}
type Query {
getTests: [Test]!
getTest(version: String): Test
}
type Mutation {
addTest(version: String!): Test
}
enum TestType {
SIMPLE,
COMPLEX
}
```
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.*;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

@ExtendWith(MockitoExtension.class)
public class PreUpdateHookHandlerTest {
Expand Down

0 comments on commit 378a5ff

Please sign in to comment.