Skip to content

Commit

Permalink
Support @interfaceObject (#38) (#52)
Browse files Browse the repository at this point in the history
Closes #7

---------

Co-authored-by: T <[email protected]>
Co-authored-by: Troy Kohler <[email protected]>
  • Loading branch information
3 people authored Mar 15, 2024
1 parent 991935b commit 589effd
Show file tree
Hide file tree
Showing 48 changed files with 3,460 additions and 1,066 deletions.
5 changes: 5 additions & 0 deletions .changeset/six-steaks-talk.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@theguild/federation-composition': minor
---

Support @interfaceObject directive
5 changes: 5 additions & 0 deletions .changeset/slimy-ads-dress.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@theguild/federation-composition': patch
---

Improve INTERFACE_KEY_MISSING_IMPLEMENTATION_TYPE
19 changes: 3 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,31 +179,18 @@ Your feedback and bug reports are welcome and appreciated.
-`REQUIRES_DIRECTIVE_IN_FIELDS_ARG`
-`TYPE_DEFINITION_INVALID`
-`OVERRIDE_COLLISION_WITH_ANOTHER_DIRECTIVE`
-`INTERFACE_OBJECT_USAGE_ERROR`
-`REQUIRED_INACCESSIBLE`
-`SATISFIABILITY_ERROR`

### TODOs

- [ ] `INTERFACE_OBJECT_USAGE_ERROR`
- [ ] `INTERFACE_FIELD_NO_IMPLEM`
- [ ] `SATISFIABILITY_ERROR`
- [ ] `DISALLOWED_INACCESSIBLE`
- [ ] `DOWNSTREAM_SERVICE_ERROR`
- [ ] `EXTERNAL_ARGUMENT_DEFAULT_MISMATCH`
- [ ] `EXTERNAL_ARGUMENT_TYPE_MISMATCH`
- [ ] `EXTERNAL_COLLISION_WITH_ANOTHER_DIRECTIVE`
- [ ] `IMPLEMENTED_BY_INACCESSIBLE`
- [ ] `INVALID_FEDERATION_SUPERGRAPH`
- [ ] `LINK_IMPORT_NAME_MISMATCH`
- [ ] `REQUIRED_INACCESSIBLE`
- [ ] `SHAREABLE_HAS_MISMATCHED_RUNTIME_TYPES`
- [ ] `UNSUPPORTED_FEATURE`
- [ ] `UNSUPPORTED_LINKED_FEATURE`
- [ ] `TYPE_WITH_ONLY_UNUSED_EXTERNAL`
- [ ] `SATISFIABILITY_ERROR` - deeply nested key fields
- [ ] `SATISFIABILITY_ERROR` - fragments in keys
- [ ] `SATISFIABILITY_ERROR` - support interfaces... (kill me)
- [ ] `SATISFIABILITY_ERROR` - @require - check if fields defined by @require can be resolved by
current subgraph or by moving to other subgraphs.
- [ ] `SATISFIABILITY_ERROR` - @provides?
- [ ] more accurate key fields comparison (I did string ≠ string but we need to make it better)
- [ ] support `@interfaceObject`
- [ ] support `[String!]!` and `[String!]` comparison, not only `String!` vs `String`
20 changes: 0 additions & 20 deletions __tests__/composition.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,8 @@ expect.addSnapshotSerializer({
});

testImplementations(api => {
const library = api.library;
const composeServices = api.composeServices;

function logSupergraph(result: { supergraphSdl: string }) {
console.log('--', library, '--');
console.log(result.supergraphSdl);
}

test('duplicated Query fields', () => {
const result = composeServices([
{
Expand Down Expand Up @@ -2960,9 +2954,6 @@ testImplementations(api => {

if (satisfiesVersionRange('< v2.3', version)) {
assertCompositionFailure(result);
if (api.library === 'apollo') {
console.log(JSON.stringify(result.errors));
}
expect(result.errors).toContainEqual(
expect.objectContaining({
message: '[a] Cannot import unknown element "@interfaceObject".',
Expand All @@ -2983,17 +2974,6 @@ testImplementations(api => {
return;
}

if (api.library === 'guild') {
// TODO: we don't support @interfaceObject yet
assertCompositionFailure(result);
expect(result.errors).toContainEqual(
expect.objectContaining({
message: expect.stringContaining('@interfaceObject is not yet supported'),
}),
);
return;
}

assertCompositionSuccess(result);

// KNOW: which interface should be extended by @interfaceObject
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ describe('transformSupergraphToPublicSchema', () => {
const resultSdl = transformSupergraphToPublicSchema(sdl);
expect(print(resultSdl)).toMatchInlineSnapshot(`
"type Query {
foo: String @deprecated(reason: \\"jooo\\")
foo: String @deprecated(reason: "jooo")
}"
`);
});
Expand Down
Loading

0 comments on commit 589effd

Please sign in to comment.