Optional federated type
See original GitHub issueWhen I want to return a type that has required fields or None unexpected error is thrown
Here https://github.com/mirumee/ariadne/blob/0.12.0/tests/federation/test_schema.py#L431-L469 you have a test that works correctly. However, when you’ll change type fields to the required test will fail with error:
[GraphQLError('Cannot return null for non-nullable field Product.name.', locations=[SourceLocation(line=6, column=25)], path=['_entities', 0, 'name'])]
Test to reproduce:
def test_federated_schema_execute_reference_resolver_that_returns_none():
type_defs = """
type Query {
rootField: String
}
type Product @key(fields: "upc") {
upc: Int!
name: String!
}
"""
product = FederatedObjectType("Product")
@product.reference_resolver()
def product_reference_resolver(_obj, _info, reference):
assert reference["upc"] == 1
# return None
schema = make_federated_schema(type_defs, product)
result = graphql_sync(
schema,
"""
query GetEntities($representations: [_Any!]!) {
_entities(representations: $representations) {
... on Product {
__typename
name
}
}
}
""",
variable_values={"representations": [{"__typename": "Product", "upc": 1,},],},
)
assert result.errors is None
assert result.data["_entities"][0]["__typename"] == "Product"
assert result.data["_entities"][0]["name"] is None
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Value types in Apollo Federation - Apollo GraphQL Docs
Types like this are called value types. This article describes how to share value types and their fields in federated graph, enabling multiple...
Read more >tff.types.FederatedType | TensorFlow Federated
An instance of tff.Type or something convertible to it, that represents the type of the member components of each value of this federated...
Read more >Chapter 11 Choosing a Federation Option - Oracle Help Center
To get started, SAML v2 is strongly preferred for federation. WS-Federation is an alternative for integrating with Active Directory Federation Services (ADFS).
Read more >Process Template Query Entity List Resource - GET Method
Use this method to retrieve a list of process template entities via a query. Sample Method Invocation. GET /rest/bpm/federated/bfm/v1/processTemplates/query/{ ...
Read more >Implementing Federated GraphQL Microservices using Apollo ...
In addition, we pass the subscriptions: false option to the apollo server ... In the Query type, the users and the user(id: ID!)...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@kamilglod it was released 4.5 hours ago, enjoy!
Indeed, master branch version works correctly! 😃 When you’re planning to release 0.13?