mirror of
https://github.com/graphql-hive/console
synced 2026-05-23 09:08:34 +00:00
Ignore descriptions when checking native federation compatibility (#4040)
This commit is contained in:
parent
cd1271088a
commit
6ebb3629e2
2 changed files with 27 additions and 10 deletions
|
|
@ -1,5 +1,5 @@
|
|||
import { createHash } from 'crypto';
|
||||
import { print } from 'graphql';
|
||||
import { DocumentNode, print, visit } from 'graphql';
|
||||
import { Injectable, Scope } from 'graphql-modules';
|
||||
import objectHash from 'object-hash';
|
||||
import type {
|
||||
|
|
@ -92,6 +92,19 @@ export function extendWithBase(
|
|||
});
|
||||
}
|
||||
|
||||
export function removeDescriptions(documentNode: DocumentNode): DocumentNode {
|
||||
return visit(documentNode, {
|
||||
enter(node) {
|
||||
if ('description' in node) {
|
||||
return {
|
||||
...node,
|
||||
description: null,
|
||||
};
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
type CreateSchemaObjectInput = Parameters<typeof createSchemaObject>[0];
|
||||
|
||||
@Injectable({
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ import { Contracts } from './contracts';
|
|||
import { FederationOrchestrator } from './orchestrators/federation';
|
||||
import { SingleOrchestrator } from './orchestrators/single';
|
||||
import { StitchingOrchestrator } from './orchestrators/stitching';
|
||||
import { ensureCompositeSchemas, SchemaHelper } from './schema-helper';
|
||||
import { ensureCompositeSchemas, removeDescriptions, SchemaHelper } from './schema-helper';
|
||||
|
||||
const ENABLE_EXTERNAL_COMPOSITION_SCHEMA = z.object({
|
||||
endpoint: z.string().url().nonempty(),
|
||||
|
|
@ -1138,18 +1138,22 @@ export class SchemaManager {
|
|||
|
||||
if (compositionResult.supergraph) {
|
||||
const sortedExistingSupergraph = print(
|
||||
sortSDL(
|
||||
parseGraphQLSource(
|
||||
compositionResult.supergraph,
|
||||
'parsing existing supergraph in getNativeFederationCompatibilityStatus',
|
||||
removeDescriptions(
|
||||
sortSDL(
|
||||
parseGraphQLSource(
|
||||
compositionResult.supergraph,
|
||||
'parsing existing supergraph in getNativeFederationCompatibilityStatus',
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
const sortedNativeSupergraph = print(
|
||||
sortSDL(
|
||||
parseGraphQLSource(
|
||||
version.supergraphSDL!,
|
||||
'parsing native supergraph in getNativeFederationCompatibilityStatus',
|
||||
removeDescriptions(
|
||||
sortSDL(
|
||||
parseGraphQLSource(
|
||||
version.supergraphSDL!,
|
||||
'parsing native supergraph in getNativeFederationCompatibilityStatus',
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in a new issue