Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/python-2.7/5.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
Graphql输入扩展了一个类型_Graphql_Apollo - Fatal编程技术网

Graphql输入扩展了一个类型

Graphql输入扩展了一个类型,graphql,apollo,Graphql,Apollo,我必须在模式中声明几个对象模型作为类型和输入 type Agreement { id: Int agmtCategCd: String agmtSubcategyCd: String } input AgreementInput { id: Int agmtCategCd: String agmtSubcategyCd: String } 正如您所看到的,AgreementInput和Agreement的主体完全相同 我想避免重复代码。有没有办

我必须在模式中声明几个对象模型作为类型和输入

type Agreement {
    id: Int
    agmtCategCd: String
    agmtSubcategyCd: String
}

input AgreementInput {
    id: Int
    agmtCategCd: String
    agmtSubcategyCd: String
}
正如您所看到的,AgreementInput和Agreement的主体完全相同

我想避免重复代码。有没有办法避免这种情况?比如说

AgreementInput extends Agreement


这个问题可能重复的问题以前已经被问过很多次了。归根结底,GraphQL本身并不支持任何类型的继承。不过,还有一些库可以添加该功能(请参见上面的链接)
input AgreementInput  = Agreement