问题标签 [graphql-shield]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
node.js - Nodejs:graphql-shield 单元测试规则
您如何看待 graphql-shield 规则的单元测试?下面是一个规则示例:
我目前在javascript中这样测试:
这种方法的问题在于 .func 是私有属性。所以对于使用打字稿的测试:
- 使用 //ts-忽略
- 从函数中的规则导出逻辑,例如authenticatedRuleLogic,但是我们最终导出函数只是为了测试,更不用说重复的函数了
也许还有另一种选择被忽略?
node.js - Apollo 服务器联盟与 graphql-shield
我graphql-shield
用来保护一个subgraph
.
在我的构建过程中,我rover CLI
用来更新supergraph schema
Apollo Studio 中的:
更新失败,rover
因为权限屏蔽引发Not Authorised!
错误。
我如何保护subgraph
并graphql-shield
允许SubgraphIntrospectQuery
操作?
我了解可以将承载令牌添加到流动站自省命令:
但是,我无法在构建过程中生成访问令牌。
graphql - Graphql-Shield 劫持错误
在解析器中,throw new createError.BadRequest("bad input")
错误被劫持Graphql-shield
并显示为
这是 Apollo 服务器设置
如何返回发生的实际错误?
node.js - Use Rover with graphql-shield
I'm using graphql-shield
on a subgraph and rover-cli
to generate the schema.
I've set the fallback rule to deny everything as I don't want anything to be accessible by default. But now rover-cli
fails when introspecting the subgraph. I'm aware that you can pass a token to rover but I'm unable to do so during my build process.
I've already looked at this issue: Apollo Server Federation with graphql-shield and on both graphql-shield
& rover
GitHub repository but not luck so far.
I've also tried to explicitly add SubgraphIntrospectQuery
like so:
Thanks for your help!