-
Notifications
You must be signed in to change notification settings - Fork 257
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #892 from apollographql/release-gateway-0.34
Release * @apollo/[email protected] * @apollo/[email protected] * @apollo/[email protected] * @apollo/[email protected] PRs: * feat(gateway): Default to Uplink for composed supergraph managed federation (#881) * fix(federation): Require user-defined @tag directive definition (#882) * Remove @inaccessible elements when converting to API schema (#807) * Move toAPISchema call into try/catch block (#894) * fix(gateway): Prevent inaccessible type names from being leaked in error messages (#893) * docs: rm instruction to set APOLLO_SCHEMA_CONFIG_DELIVERY_ENDPOINT for Uplink (#899) * fix(gateway): Remove path, query and variables field from subgraph error responses (#900)
- Loading branch information
Showing
44 changed files
with
1,408 additions
and
215 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 82 additions & 0 deletions
82
federation-integration-testsuite-js/src/fixtures/special-cases/supergraphWithInaccessible.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
import { composeAndValidate } from '@apollo/federation'; | ||
import { assertCompositionSuccess } from '@apollo/federation/dist/composition/utils'; | ||
import { | ||
DirectiveDefinitionNode, | ||
SchemaDefinitionNode, | ||
DocumentNode, | ||
DirectiveNode, | ||
parse, | ||
visit, | ||
} from 'graphql'; | ||
import { fixtures } from '..'; | ||
|
||
const compositionResult = composeAndValidate(fixtures); | ||
assertCompositionSuccess(compositionResult); | ||
const parsed = parse(compositionResult.supergraphSdl); | ||
|
||
// We need to collect the AST for the inaccessible definition as well | ||
// as the @core and @inaccessible usages. Parsing SDL is a fairly | ||
// clean approach to this and easier to update than handwriting the AST. | ||
const [inaccessibleDefinition, schemaDefinition] = parse(`#graphql | ||
# inaccessibleDefinition | ||
directive @inaccessible on FIELD_DEFINITION | OBJECT | INTERFACE | UNION | ||
schema | ||
# inaccessibleCoreUsage | ||
@core(feature: "https://specs.apollo.dev/inaccessible/v0.1") | ||
# inaccessibleUsage | ||
@inaccessible { | ||
query: Query | ||
} | ||
`).definitions as [DirectiveDefinitionNode, SchemaDefinitionNode]; | ||
|
||
const [inaccessibleCoreUsage, inaccessibleUsage] = | ||
schemaDefinition.directives as [DirectiveNode, DirectiveNode]; | ||
|
||
// Append the AST with the inaccessible definition, and @core inaccessible usage | ||
let superGraphWithInaccessible: DocumentNode = visit(parsed, { | ||
Document(node) { | ||
return { | ||
...node, | ||
definitions: [...node.definitions, inaccessibleDefinition], | ||
}; | ||
}, | ||
SchemaDefinition(node) { | ||
return { | ||
...node, | ||
directives: [...(node.directives ?? []), inaccessibleCoreUsage], | ||
}; | ||
}, | ||
}); | ||
|
||
// Append @inaccessible usage to the `Car` type, `ssn` field, and `topCars` field | ||
superGraphWithInaccessible = visit( | ||
superGraphWithInaccessible, | ||
{ | ||
ObjectTypeDefinition(node) { | ||
if (node.name.value === 'Car') { | ||
return { | ||
...node, | ||
directives: [...(node.directives ?? []), inaccessibleUsage], | ||
}; | ||
} | ||
return node; | ||
}, | ||
FieldDefinition(node) { | ||
if (node.name.value === 'ssn') { | ||
return { | ||
...node, | ||
directives: [...(node.directives ?? []), inaccessibleUsage], | ||
}; | ||
} | ||
if (node.name.value === 'topCars') { | ||
return { | ||
...node, | ||
directives: [...(node.directives ?? []), inaccessibleUsage], | ||
}; | ||
} | ||
return node; | ||
} | ||
}, | ||
); | ||
|
||
export { superGraphWithInaccessible }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.