amplify-swift/AmplifyPlugins/DataStore/AWSDataStoreCategoryPluginC.../PrimaryKey
Michael Law dfda3d4577
fix(datastore-v1): skip has-many model to graphQL translation (#2663)
2023-01-10 18:12:38 -05:00
..
10 fix(datastore-v1): skip has-many model to graphQL translation (#2663) 2023-01-10 18:12:38 -05:00
AWSDataStorePrimaryKeyBaseTest.swift fix(datastore-v1): skip has-many model to graphQL translation (#2663) 2023-01-10 18:12:38 -05:00
AWSDataStorePrimaryKeyPostCommentCompositeKeyTest.swift fix(datastore-v1): skip has-many model to graphQL translation (#2663) 2023-01-10 18:12:38 -05:00
AWSDataStorePrimaryKeyTests.swift fix(datastore-v1): skip has-many model to graphQL translation (#2663) 2023-01-10 18:12:38 -05:00
README.md fix(datastore-v1): skip has-many model to graphQL translation (#2663) 2023-01-10 18:12:38 -05:00

README.md

DataStore Primary Key Integration Tests

The following steps demonstrate how to setup a GraphQL endpoint for testing Custom Primary Key (CPK) use cases.

Set-up

The following steps have been tested with Amplify CLI v10.5.0.

  1. amplify init

Make sure the cli.json has CPK feature enabled:

"respectprimarykeyattributesonconnectionfield": true

Amplify CLI version 10.5.0 is the minimum version that defaults the feature flag to true.

  1. amplify add api
? Select from one of the below mentioned services: GraphQL
? Here is the GraphQL API that we will create. Select a setting to edit or continue Authorization modes: API key (default, expiration time: 7 days fro
m now)
? Choose the default authorization type for the API: "API key"
? Configure additional auth types? "No"
? Here is the GraphQL API that we will create. Select a setting to edit or continue Conflict detection (required for DataStore): Auto Merge
? Here is the GraphQL API that we will create. Select a setting to edit or continue (Use arrow keys)
  Name: datastorepkinteg
  Authorization modes: API key
  Conflict detection (required for DataStore): Enabled
  Conflict resolution strategy: Auto Merge
? Choose a schema template: Blank Schema

Copy the content of the schema from AWSDataStoreCategoryPluginIntegrationTests/PrimaryKey/schema.graphql into the newly created schema.graphql file

  1. amplify update api ? Please select from one of the below mentioned services: GraphQL ? Select from the options below Enable DataStore for entire API

  2. amplify push

? Are you sure you want to continue? `Yes`
? Do you want to generate code for your newly created GraphQL API `No`
  1. Copy amplifyconfiguration.json to a new file named AWSDataStoreCategoryPluginPrimaryKeyIntegrationTests-amplifyconfiguration.json inside ~/.aws-amplify/amplify-ios/testconfiguration/

Now you can run the AWSDataStoreCategoryPluginPrimaryKeyIntegrationTests