Skip to content

Commit

Permalink
expand fixes (#5885)
Browse files Browse the repository at this point in the history
  • Loading branch information
lennyburdette authored Aug 27, 2024
1 parent 64f4a60 commit c68d56a
Show file tree
Hide file tree
Showing 11 changed files with 447 additions and 30 deletions.
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
schema
@link(url: "https://specs.apollo.dev/link/v1.0")
@link(url: "https://specs.apollo.dev/join/v0.5", for: EXECUTION)
@link(url: "https://specs.apollo.dev/tag/v0.3")
@link(url: "https://specs.apollo.dev/inaccessible/v0.2", for: SECURITY)
@link(url: "https://specs.apollo.dev/tag/v0.3", import: ["@tag"])
@link(url: "https://specs.apollo.dev/inaccessible/v0.2", import: ["@inaccessible"], for: SECURITY)
@link(url: "https://specs.apollo.dev/authenticated/v0.1", import: ["@authenticated"], for: SECURITY)
@link(url: "https://specs.apollo.dev/requiresScopes/v0.1", import: ["@requiresScopes"], for: SECURITY)
@link(url: "https://specs.apollo.dev/policy/v0.1", import: ["@policy"], for: SECURITY)
@link(url: "http://specs.example.org/custom/v0.1", import: ["@custom"])
@link(url: "https://specs.apollo.dev/connect/v0.1", for: EXECUTION)
@join__directive(graphs: [ONE], name: "link", args: {url: "https://specs.apollo.dev/connect/v0.1", import: ["@connect", "@source"]})
@join__directive(graphs: [ONE], name: "source", args: {name: "json", http: {baseURL: "http://example/"}})
{
query: Query
}

directive @authenticated on FIELD_DEFINITION | OBJECT | INTERFACE | SCALAR | ENUM

directive @custom on OBJECT | FIELD_DEFINITION

directive @inaccessible on FIELD_DEFINITION | OBJECT | INTERFACE | UNION | ARGUMENT_DEFINITION | SCALAR | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION

directive @join__directive(graphs: [join__Graph!], name: String!, args: join__DirectiveArguments) repeatable on SCHEMA | OBJECT | INTERFACE | FIELD_DEFINITION
Expand All @@ -27,6 +36,10 @@ directive @join__unionMember(graph: join__Graph!, member: String!) repeatable on

directive @link(url: String, as: String, for: link__Purpose, import: [link__Import]) repeatable on SCHEMA

directive @policy(policies: [[policy__Policy!]!]!) on FIELD_DEFINITION | OBJECT | INTERFACE | SCALAR | ENUM

directive @requiresScopes(scopes: [[requiresScopes__Scope!]!]!) on FIELD_DEFINITION | OBJECT | INTERFACE | SCALAR | ENUM

directive @tag(name: String!) repeatable on FIELD_DEFINITION | OBJECT | INTERFACE | UNION | ARGUMENT_DEFINITION | SCALAR | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION | SCHEMA

input join__ContextArgument {
Expand Down Expand Up @@ -61,12 +74,14 @@ enum link__Purpose {
EXECUTION
}

scalar policy__Policy

type Query
@join__type(graph: ONE)
@join__type(graph: TWO)
{
ts: [T] @join__field(graph: ONE) @join__directive(graphs: [ONE], name: "connect", args: {source: "json", http: {GET: "/t"}, selection: "id\ntagged\nhidden\n# custom\n# authenticated\n# requiresScopes\n# policy\noverridden"})
t(id: ID): T @join__field(graph: ONE) @join__directive(graphs: [ONE], name: "connect", args: {source: "json", http: {GET: "/t/{$args.id}"}, selection: "id\ntagged\nhidden\n# custom\n# authenticated\n# requiresScopes\n# policy\noverridden", entity: true})
ts: [T] @join__field(graph: ONE) @join__directive(graphs: [ONE], name: "connect", args: {source: "json", http: {GET: "/t"}, selection: "id\ntagged\nhidden\ncustom\nauthenticated\nrequiresScopes\npolicy\noverridden"})
t(id: ID): T @join__field(graph: ONE) @join__directive(graphs: [ONE], name: "connect", args: {source: "json", http: {GET: "/t/{$args.id}"}, selection: "id\ntagged\nhidden\ncustom\nauthenticated\nrequiresScopes\npolicy\noverridden", entity: true})
}

type R
Expand All @@ -75,13 +90,19 @@ type R
id: ID!
}

scalar requiresScopes__Scope

type T
@join__type(graph: ONE, key: "id")
@join__type(graph: TWO, key: "id")
{
id: ID!
tagged: String @join__field(graph: ONE) @tag(name: "tag")
hidden: String @inaccessible @join__field(graph: ONE)
custom: String @join__field(graph: ONE) @custom
authenticated: String @join__field(graph: ONE) @authenticated
requiresScopes: String @join__field(graph: ONE) @requiresScopes(scopes: ["scope"])
policy: String @join__field(graph: ONE) @policy(policies: [["admin"]])
overridden: String @join__field(graph: ONE, override: "two", overrideLabel: "label") @join__field(graph: TWO, overrideLabel: "label")
r: R @join__field(graph: ONE) @join__directive(graphs: [ONE], name: "connect", args: {source: "json", http: {GET: "/t/{$this.id}/r"}, selection: "id"})
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# rover supergraph compose --config apollo-federation/src/sources/connect/expand/tests/schemas/carryover.yaml > apollo-federation/src/sources/connect/expand/tests/schemas/carryover.graphql
federation_version: =2.9.0-connectors.9
federation_version: =2.10.0-alpha.0
subgraphs:
one:
routing_url: none
Expand All @@ -15,9 +15,9 @@ subgraphs:
)
@link(url: "http://specs.example.org/custom/v0.1", import: ["@custom"])
@link(url: "https://specs.apollo.dev/connect/v0.1", import: ["@connect", "@source"])
# @composeDirective(name: "@custom")
@composeDirective(name: "@custom")
@source(name: "json" http: { baseURL: "http://example/" })
# directive @custom on OBJECT | FIELD_DEFINITION
directive @custom on OBJECT | FIELD_DEFINITION
type Query {
ts: [T] @connect(
source: "json"
Expand All @@ -26,10 +26,10 @@ subgraphs:
id
tagged
hidden
# custom
# authenticated
# requiresScopes
# policy
custom
authenticated
requiresScopes
policy
overridden
"""
)
Expand All @@ -40,10 +40,10 @@ subgraphs:
id
tagged
hidden
# custom
# authenticated
# requiresScopes
# policy
custom
authenticated
requiresScopes
policy
overridden
"""
entity: true
Expand All @@ -54,10 +54,10 @@ subgraphs:
id: ID!
tagged: String @tag(name: "tag")
hidden: String @inaccessible
# custom: String @custom
# authenticated: String @authenticated
# requiresScopes: String @requiresScopes(scopes: ["scope"])
# policy: String @policy(policies: [["admin"]])
custom: String @custom
authenticated: String @authenticated
requiresScopes: String @requiresScopes(scopes: ["scope"])
policy: String @policy(policies: [["admin"]])
overridden: String @override(from: "two", label: "label")
r: R @connect(
source: "json"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
schema
@link(url: "https://specs.apollo.dev/link/v1.0")
@link(url: "https://specs.apollo.dev/join/v0.4", for: EXECUTION)
@link(url: "https://specs.apollo.dev/join/v0.5", for: EXECUTION)
@link(url: "https://specs.apollo.dev/connect/v0.1", for: EXECUTION)
@join__directive(graphs: [CONNECTORS], name: "link", args: {url: "https://specs.apollo.dev/connect/v0.1", import: ["@connect", "@source"]})
@join__directive(graphs: [CONNECTORS], name: "source", args: {name: "example", http: {baseURL: "http://example"}})
{
query: Query
mutation: Mutation
}

directive @join__directive(graphs: [join__Graph!], name: String!, args: join__DirectiveArguments) repeatable on SCHEMA | OBJECT | INTERFACE | FIELD_DEFINITION

directive @join__enumValue(graph: join__Graph!) repeatable on ENUM_VALUE

directive @join__field(graph: join__Graph, requires: join__FieldSet, provides: join__FieldSet, type: String, external: Boolean, override: String, usedOverridden: Boolean, overrideLabel: String) repeatable on FIELD_DEFINITION | INPUT_FIELD_DEFINITION
directive @join__field(graph: join__Graph, requires: join__FieldSet, provides: join__FieldSet, type: String, external: Boolean, override: String, usedOverridden: Boolean, overrideLabel: String, contextArguments: [join__ContextArgument!]) repeatable on FIELD_DEFINITION | INPUT_FIELD_DEFINITION

directive @join__graph(name: String!, url: String!) on ENUM_VALUE

Expand Down Expand Up @@ -40,6 +42,23 @@ type AddressGeo
lng: Float
}

input AddressGeoInput
@join__type(graph: CONNECTORS)
{
lat: Float
lng: Float
}

input AddressInput
@join__type(graph: CONNECTORS)
{
street: String
suite: String
city: String
zipcode: String
geo: AddressGeoInput
}

type CompanyInfo
@join__type(graph: CONNECTORS)
{
Expand All @@ -56,13 +75,32 @@ input CompanyInput
catchPhrase: String
}

input CreateUserInput
@join__type(graph: CONNECTORS)
{
name: String!
username: String!
email: EmailAddress
status: Status
address: AddressInput
}

scalar EmailAddress
@join__type(graph: CONNECTORS)

input join__ContextArgument {
name: String!
type: String!
context: String!
selection: join__FieldValue!
}

scalar join__DirectiveArguments

scalar join__FieldSet

scalar join__FieldValue

enum join__Graph {
CONNECTORS @join__graph(name: "connectors", url: "none")
}
Expand All @@ -81,6 +119,12 @@ enum link__Purpose {
EXECUTION
}

type Mutation
@join__type(graph: CONNECTORS)
{
createUser(input: CreateUserInput!): User @join__directive(graphs: [CONNECTORS], name: "connect", args: {source: "example", http: {POST: "/create/user", body: "$args.input { name username email status address { street suite city zipcode geo { lat lng } } }"}, selection: "id"})
}

type Query
@join__type(graph: CONNECTORS)
{
Expand All @@ -89,6 +133,13 @@ type Query
user(id: ID!): User @join__directive(graphs: [CONNECTORS], name: "connect", args: {source: "example", http: {GET: "/{$args.id}"}, selection: "id\nname\nusername\nemail\naddress {\n street\n suite\n city\n zipcode\n geo {\n lat\n lng\n }\n}\nphone\nwebsite\ncompany {\n name\n catchPhrase\n bs\n email\n}", entity: true})
}

enum Status
@join__type(graph: CONNECTORS)
{
ACTIVE @join__enumValue(graph: CONNECTORS)
INACTIVE @join__enumValue(graph: CONNECTORS)
}

type User
@join__type(graph: CONNECTORS, key: "id")
{
Expand All @@ -100,4 +151,5 @@ type User
phone: String
website: String
company: CompanyInfo
status: Status
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
federation_version: =2.9.0-connectors.0
# rover supergraph compose --config apollo-federation/src/sources/connect/expand/tests/schemas/realistic.yaml > apollo-federation/src/sources/connect/expand/tests/schemas/realistic.graphql
# this is currently manually edited to add Status enum and EmailAddress scalars to the input type
federation_version: =2.10.0-alpha.0
subgraphs:
connectors:
routing_url: none
schema:
sdl: |
extend schema
@link(
url: "https://specs.apollo.dev/federation/v2.7"
url: "https://specs.apollo.dev/federation/v2.10"
import: ["@key"]
)
@link(url: "https://specs.apollo.dev/connect/v0.1", import: ["@connect", "@source"])
Expand Down Expand Up @@ -64,6 +66,7 @@ subgraphs:
phone: String
website: String
company: CompanyInfo
status: String # Status
}
type Address {
Expand All @@ -83,7 +86,7 @@ subgraphs:
name: String
catchPhrase: String
bs: String
email: EmailAddress
email: String # EmailAddress
}
input CompanyInput {
Expand All @@ -92,3 +95,34 @@ subgraphs:
}
scalar EmailAddress
enum Status {
ACTIVE
INACTIVE
}
type Mutation {
createUser(input: CreateUserInput!): User
@connect(source: "example", http: { POST: "/create/user", body: "$$args.input { name username email status address { street suite city zipcode geo { lat lng } } }" }, selection: "id")
}
input CreateUserInput {
name: String!
username: String!
email: String # EmailAddress!
status: String # Status!
address: AddressInput
}
input AddressInput {
street: String
suite: String
city: String
zipcode: String
geo: AddressGeoInput
}
input AddressGeoInput {
lat: Float
lng: Float
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,26 @@ expression: connectors.by_service_name
"hidden",
None,
),
Field(
None,
"custom",
None,
),
Field(
None,
"authenticated",
None,
),
Field(
None,
"requiresScopes",
None,
),
Field(
None,
"policy",
None,
),
Field(
None,
"overridden",
Expand Down Expand Up @@ -159,6 +179,26 @@ expression: connectors.by_service_name
"hidden",
None,
),
Field(
None,
"custom",
None,
),
Field(
None,
"authenticated",
None,
),
Field(
None,
"requiresScopes",
None,
),
Field(
None,
"policy",
None,
),
Field(
None,
"overridden",
Expand Down
Loading

0 comments on commit c68d56a

Please sign in to comment.