Skip to content

Commit 701c927

Browse files
committed
Fix
1 parent a6d3720 commit 701c927

File tree

5 files changed

+28
-30
lines changed

5 files changed

+28
-30
lines changed
Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,13 @@
1-
import {
2-
defineConfig,
3-
loadGraphQLHTTPSubgraph,
4-
} from '@graphql-mesh/compose-cli';
1+
import { defineConfig, loadGraphQLHTTPSubgraph } from '@graphql-mesh/compose-cli';
52

63
export const composeConfig = defineConfig({
74
ignoreSemanticConventions: true,
85
subgraphs: [
96
{
10-
sourceHandler: loadGraphQLHTTPSubgraph('books',
11-
{
12-
endpoint: 'http://localhost:4001/graphql',
13-
source: './schema.graphql',
14-
}
15-
),
7+
sourceHandler: loadGraphQLHTTPSubgraph('books', {
8+
endpoint: 'http://localhost:4001/graphql',
9+
source: './schema.graphql',
10+
}),
1611
},
1712
],
1813
});
Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
1-
import {
2-
defineConfig,
3-
loadGraphQLHTTPSubgraph,
4-
} from '@graphql-mesh/compose-cli';
1+
import { defineConfig, loadGraphQLHTTPSubgraph } from '@graphql-mesh/compose-cli';
52

63
export const composeConfig = defineConfig({
74
subgraphs: [
85
{
9-
sourceHandler: loadGraphQLHTTPSubgraph('books',
10-
{
11-
endpoint: 'http://localhost:4001/graphql',
12-
source: './schema.graphql',
13-
}
14-
),
6+
sourceHandler: loadGraphQLHTTPSubgraph('books', {
7+
endpoint: 'http://localhost:4001/graphql',
8+
source: './schema.graphql',
9+
}),
1510
},
1611
],
1712
});
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
type Query {
2-
bookById(id: ID!): Book
2+
bookById(id: ID!): Book
33
}
44

55
type Book {
6-
id: ID!
6+
id: ID!
77
}

e2e/semantic-conventions/semantic-conventions.test.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,17 @@ const { compose, fs } = createTenv(__dirname);
44
const regExp = /@merge\(.*\)/;
55

66
it('should generate merge directives', async () => {
7-
const { output } = await compose({ output: 'graphql', args: ['-c', 'mesh.config.conventions-enabled.ts'] });
7+
const { output } = await compose({
8+
output: 'graphql',
9+
args: ['-c', 'mesh.config.conventions-enabled.ts'],
10+
});
811
await expect(fs.read(output)).resolves.toMatch(regExp);
912
});
1013

1114
it('should not generate merge directives', async () => {
12-
const { output } = await compose({ output: 'graphql', args: ['-c', 'mesh.config.conventions-disabled.ts'] });
15+
const { output } = await compose({
16+
output: 'graphql',
17+
args: ['-c', 'mesh.config.conventions-disabled.ts'],
18+
});
1319
await expect(fs.read(output)).resolves.not.toMatch(regExp);
1420
});

packages/compose-cli/src/getComposedSchemaFromConfig.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -116,20 +116,22 @@ export async function getComposedSchemaFromConfig(config: MeshComposeCLIConfig,
116116
);
117117
}
118118
}
119-
const options = {
120-
ignoreSemanticConventions: config.ignoreSemanticConventions,
121-
alwaysAddTransportDirective: true,
122-
};
123119
if (config.subgraph) {
124-
const annotatedSubgraphs = getAnnotatedSubgraphs(subgraphConfigsForComposition, options);
120+
const annotatedSubgraphs = getAnnotatedSubgraphs(subgraphConfigsForComposition, {
121+
ignoreSemanticConventions: config.ignoreSemanticConventions,
122+
alwaysAddTransportDirective: true,
123+
});
125124
const subgraph = annotatedSubgraphs.find(sg => sg.name === config.subgraph);
126125
if (!subgraph) {
127126
logger.error(`Subgraph ${config.subgraph} not found`);
128127
process.exit(1);
129128
}
130129
return print(subgraph.typeDefs);
131130
}
132-
const result = composeSubgraphs(subgraphConfigsForComposition, options);
131+
const result = composeSubgraphs(subgraphConfigsForComposition, {
132+
ignoreSemanticConventions: config.ignoreSemanticConventions,
133+
alwaysAddTransportDirective: false,
134+
});
133135
if (result.errors?.length) {
134136
logger.error(`Failed to compose subgraphs`);
135137
for (const error of result.errors) {

0 commit comments

Comments
 (0)