简体   繁体   English

无法在中继编译器中为突变生成自动生成的文件

[英]Unable to generate auto generated files in relay compiler for mutations

I am trying to create a web application with ReactJs as frontend, GraphQL as service layer and Relay as communication between service layer and frontend.我正在尝试使用ReactJs作为前端、 GraphQL作为服务层和Relay作为服务层和前端之间的通信来创建一个 Web 应用程序。

In this i created a mutation in service layer and integrated in front end.At last tried to generate files using following commands在此我在服务层创建了一个突变并集成到前端。最后尝试使用以下命令生成文件

  1. relay-compiler --src ./src --schema ./schema.graphql中继编译器 --src ./src --schema ./schema.graphql

  2. get-graphql-schema http://localhost:6001/xampr > schema.graphql get-graphql-schema http://localhost:6001/xampr > schema.graphql

None of these are working by throwing this errors通过抛出此错误,这些都不起作用

  • Writing js编写js

    ERROR:错误:
    You supplied a GraphQL document with validation errors:Unknown type "GetActivityMessagesRequestInput".您提供了一个带有验证错误的 GraphQL 文档:未知类型“GetActivityMessagesRequestInput”。 Services/Auth/GetActivityMessagesMutation.js (2:49) 1: 2: mutation GetActivityMessagesMutation($input:GetActivityMessagesRequestInput!) { ^3: getActivityMessagesRequest(input : $input){ error Command failed with exit code 100. Services/Auth/GetActivityMessagesMutation.js (2:49) 1: 2: mutation GetActivityMessagesMutation($input:GetActivityMessagesRequestInput!) { ^3: getActivityMessagesRequest(input : $input){ error 命令失败,退出代码 100。

  • GraphQL is not found找不到 GraphQL

  • Stack is empty unable to convert undefined to graphQL query堆栈为空无法将未定义转换为 graphQL 查询

My relay script tag is我的中继脚本标签是

"relay": "relay-compiler --src ./src --schema ./schema.graphql --watchman false"

Tried to uninstall an reinstall all packages试图卸载并重新安装所有软件包

"relay": "relay-compiler --src ./src --schema ./schema.graphql --watchman false"

Unable to create generated mutation files using relay compiler无法使用中继编译器创建生成的变异文件

According to the error message, GetActivityMessagesRequestInput isn't a valid graphQL input defined in your schema.根据错误消息, GetActivityMessagesRequestInput不是您的架构中定义的有效 graphQL input

Check your server schema for that input definition if it exists, else see what the right input to pass to that mutation is.检查您的服务器架构是否存在该input定义,否则查看传递给该突变的正确input是什么。 You might as well call the scalar input directly.您不妨直接调用scalar input

It might be GetActivityMessagesCreateInput .它可能是GetActivityMessagesCreateInput

Example to demonstrate what I mean.举例说明我的意思。

signin(email: String!, password: String!): AuthPayload! updateProfile(data: UserUpdateInput!, id: ID): User!

If I call sign mutation like so如果我像这样调用符号突变

mutation SignIn ($input: SignInMutationInput!) { signin(input: $input){ user: { id, email } token }

It will return the same error as yours saying You supplied a GraphQL document with validation errors:Unknown type "SignInMutationInput"它将返回与您相同的错误,说You supplied a GraphQL document with validation errors:Unknown type "SignInMutationInput"

To fix the above, I can either create a custom input type in my server called input SignInMutationInput { email: String! password: String! }为了解决上述问题,我可以在我的服务器中创建一个自定义输入类型,称为input SignInMutationInput { email: String! password: String! } input SignInMutationInput { email: String! password: String! } input SignInMutationInput { email: String! password: String! } OR change the way I'm calling the mutation like so; input SignInMutationInput { email: String! password: String! }或更改我打电话,像这样的突变的方式;

mutation SignIn ($email: String!, $password: String! ) { signin(email: $email, password: $password){ user: { id, email } token }

I hope this helps.我希望这有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM