mercurius
Advanced tools
Comparing version 8.4.0 to 8.4.1
@@ -95,2 +95,6 @@ /* | ||
for (const definition of schemaDefinitions) { | ||
if (definition.kind === 'SchemaDefinition') { | ||
continue | ||
} | ||
const typeName = definition.name.value | ||
@@ -97,0 +101,0 @@ const isTypeExtensionByDirective = hasExtensionDirective(definition) |
{ | ||
"name": "mercurius", | ||
"version": "8.4.0", | ||
"version": "8.4.1", | ||
"description": "Fastify GraphQL adapter with gateway and subscription support", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -1028,1 +1028,63 @@ 'use strict' | ||
}) | ||
test('basic federation support with \'schema\' in the schema', async (t) => { | ||
const app = Fastify() | ||
const schema = ` | ||
extend type Query { | ||
me: User | ||
} | ||
type User @key(fields: "id") { | ||
id: ID! | ||
name: String | ||
username: String | ||
} | ||
schema { | ||
query: Query | ||
} | ||
` | ||
const resolvers = { | ||
Query: { | ||
me: () => { | ||
return { | ||
id: '1', | ||
name: 'John', | ||
username: '@john' | ||
} | ||
} | ||
}, | ||
User: { | ||
__resolveReference: (object) => { | ||
return { | ||
id: object.id, | ||
name: 'John', | ||
username: '@john' | ||
} | ||
} | ||
} | ||
} | ||
app.register(GQL, { | ||
schema, | ||
resolvers, | ||
federationMetadata: true | ||
}) | ||
await app.ready() | ||
const query = '{ _service { sdl } }' | ||
const res = await app.inject({ | ||
method: 'GET', | ||
url: `/graphql?query=${query}` | ||
}) | ||
t.same(JSON.parse(res.body), { | ||
data: { | ||
_service: { | ||
sdl: schema | ||
} | ||
} | ||
}) | ||
}) |
775230
27391