I'm using the following AWS Amplify tutorial for Angular:
https://docs.amplify.aws/start/getting-started/data-model/q/integration/angular#model-the-data-with-graphql-transform
When I generate the GraphQL API I get red warning messages for the @model
directive:
I'm using WebStorm. How can I get my editor to not throw these red warning errors? Do I need to install some @types package or install some plugin?
Once your API is deployed, updating the schema is easy with the CLI. You can edit the schema file(s) and run amplify push command to update your GraphQL backend. When you run the push command, you will notice that your schema change is automatically detected, and your backend will be updated respectively.
AWS Amplify can integrate with any GraphQL provider to perform queries and real-time data subscriptions via it's easy to use GraphQL client. AWS AppSync extends GraphQL's capabilities even more by offering enterprise-level security, real-time data synchronization, and orchestration of backend data resources.
Amazon DynamoDB Although DynamoDB is Amplify DataStore's default database solution, developers can create AWS AppSync resolvers to use different purpose-built database offerings provided by AWS.
First, create .graphqlconfig
file with the following content:
{
"schemaPath": "schema.graphql",
"includes": ["*"],
"extensions": {
"endpoints": {}
}
}
Then, create graphql-directives.js
file with the following content:
import gql from 'graphql-tag';
const clientSchemaExtensions = gql`
directive @model on OBJECT
scalar AWSDateTime
`;
After that, there are no syntax errors anymore!
This answer was adapted from this repo.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With