【问题标题】:"Unknown directive model" when setting up AWS Amplify GraphQL API in WebStorm在 WebStorm 中设置 AWS Amplify GraphQL API 时出现“未知指令模型”
【发布时间】:2021-05-31 15:03:01
【问题描述】:

我正在使用以下适用于 Angular 的 AWS Amplify 教程:

https://docs.amplify.aws/start/getting-started/data-model/q/integration/angular#model-the-data-with-graphql-transform

当我生成 GraphQL API 时,我收到@model 指令的红色警告消息:

我正在使用 WebStorm。如何让我的编辑器不抛出这些红色警告错误?我需要安装一些@types 包还是安装一些插件?

【问题讨论】:

  • ...寻求支持?

标签: angular amazon-web-services graphql webstorm aws-amplify


【解决方案1】:

首先,创建.graphqlconfig 文件,内容如下:

{
  "schemaPath": "schema.graphql",
  "includes": ["*"],
  "extensions": {
    "endpoints": {}
  }
}

然后,创建graphql-directives.js 文件,内容如下:

import gql from 'graphql-tag';

const clientSchemaExtensions = gql`
  directive @model on OBJECT
  scalar AWSDateTime
`;

之后,就没有语法错误了!

这个答案改编自from this repo

【讨论】:

猜你喜欢
  • 2020-08-14
  • 2022-01-16
  • 2020-03-27
  • 2021-09-23
  • 2021-06-22
  • 2021-02-07
  • 2019-03-19
  • 2022-01-03
相关资源
最近更新 更多