GraphQL: Support required fields on output type (#6279)
* Handle required fields * Fix output fields
This commit is contained in:
committed by
Antonio Davi Macedo Coelho de Castro
parent
2fc328ed24
commit
a72ab50c70
@@ -1886,6 +1886,32 @@ describe('ParseGraphQLServer', () => {
|
||||
expect(
|
||||
__type.inputFields.find(o => o.name === 'doors').type.kind
|
||||
).toEqual('NON_NULL');
|
||||
|
||||
const {
|
||||
data: { __type: __type2 },
|
||||
} = await apolloClient.query({
|
||||
query: gql`
|
||||
query requiredFields {
|
||||
__type(name: "SuperCar") {
|
||||
fields {
|
||||
name
|
||||
type {
|
||||
kind
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`,
|
||||
});
|
||||
expect(
|
||||
__type2.fields.find(o => o.name === 'price').type.kind
|
||||
).toEqual('SCALAR');
|
||||
expect(
|
||||
__type2.fields.find(o => o.name === 'engine').type.kind
|
||||
).toEqual('NON_NULL');
|
||||
expect(
|
||||
__type2.fields.find(o => o.name === 'doors').type.kind
|
||||
).toEqual('NON_NULL');
|
||||
});
|
||||
|
||||
it('should only allow the supplied output fields for a class', async () => {
|
||||
|
||||
Reference in New Issue
Block a user