Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/amazon-web-services/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Amazon web services 如何在部署之前从@aws cdk/aws appsync检索schema.graphql文件_Amazon Web Services_Graphql_Aws Appsync_Aws Cdk - Fatal编程技术网

Amazon web services 如何在部署之前从@aws cdk/aws appsync检索schema.graphql文件

Amazon web services 如何在部署之前从@aws cdk/aws appsync检索schema.graphql文件,amazon-web-services,graphql,aws-appsync,aws-cdk,Amazon Web Services,Graphql,Aws Appsync,Aws Cdk,我正在使用生成graphql模式。出于Typescript代码生成的目的,我需要一种在部署之前检索schema.graphql的方法(可能以某种方式从cdk synth命令中提取它?。我不确定我们是否面临同样的问题。基本上,我希望在我的客户机react应用程序中访问GQL模式,该应用程序与定义基础结构的cdk应用程序位于不同的存储库中 最后,我使用aws cli使用以下命令提取appsync架构: aws appsync get-introspection-schema --api-id [AP

我正在使用生成graphql模式。出于Typescript代码生成的目的,我需要一种在部署之前检索schema.graphql的方法(可能以某种方式从
cdk synth
命令中提取它?。

我不确定我们是否面临同样的问题。基本上,我希望在我的客户机react应用程序中访问GQL模式,该应用程序与定义基础结构的cdk应用程序位于不同的存储库中

最后,我使用aws cli使用以下命令提取appsync架构:

aws appsync get-introspection-schema --api-id [API-ID] --format SDL --no-include-directives outfile=[OUTFILE]

要在部署前获取自动创建的架构,请使用以下脚本:

readFile('cdk.out/.template.json','utf8',(err,data)=>{
如果(错误){
犯错误;
}
const definition=JSON.parse(数据)
.资源
.//替换为您的架构id
.物业
.定义;
writeFile('lib/domain/generated.graphql',定义,(错误)=>{
如果(错误)抛出错误;
});
});

不同的问题待定。为了在我的客户端应用程序中同步模式,我使用了amplify。