Skip to content
Open
Show file tree
Hide file tree
Changes from 16 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion deps.edn
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@

:codox/config
{:description "Clojure-native implementation of GraphQL"
:source-uri "https://github.com/walmartlabs/lacinia/blob/master/{filepath}#L{line}"}}
:source-uri "https://github.com/walmartlabs/lacinia/blob/master/{filepath}#L{line}"}}
81 changes: 81 additions & 0 deletions dev-resources/edn-federation.edn
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
{:roots
{:query :Query
:mutation :Mutation
:subscription :Subscription}
:objects
{:_Service
{:fields
{:sdl
{:type (non-null String)}}}
:User
{:fields
{:id
{:type (non-null Int)}
:name
{:type (non-null String)}}
:directives [{:directive-type :key :directive-args {:fields "id"}}]}
:Query
{:fields
{:user_by_id
{:type :User :args
{:id
{:type (non-null Int)}}}}}
:Account
{:fields
{:acct_number
{:type (non-null String)} :name
{:type (non-null String)}}
:directives [{:directive-type :key :directive-args {:fields "acct_number"}}]}
:Product
{:fields
{:upc
{:type (non-null String) :directives [{:directive-type :external}]} :reviewed_by
{:type :User}}
:directives [{:directive-type :key :directive-args {:fields "upc"}}
{:directive-type :extends}]}}
:scalars
{:_Any
{:parse :_Any/parser,
:serialize :_Any/serializer},
:_FieldSet
{:parse :_FieldSet/parser,
:serialize :_FieldSet/serializer}
:link__Import
{:parse :link__Import/parser,
:serialize :link__Import/serializer}}

:enums
{:link__Purpose
{:values [{:enum-value :SECURITY} {:enum-value :EXECUTION}]}}

:directive-defs
{:external
{:locations #{:field-definition}}
:requires
{:locations #{:field-definition}
:args {:fields {:type (non-null _FieldSet)}}}
:provides
{:locations #{:field-definition}
:args {:fields {:type (non-null _FieldSet)}}}
:key
{:locations #{:object :interface}
:args {:fields {:type (non-null _FieldSet)}
:resolvable {:type Boolean :default-value true}}}
:link
{:locations #{:schema},
:args {:url {:type String}, :as {:type String}, :for {:type :link__Purpose}, :import {:type (list :link__Import)}}}
:shareable {:locations #{:field-definition :object}},
:inaccessible
{:locations
#{:enum
:input-field-definition
:interface
:input-object
:enum-value
:scalar
:argument-definition
:union
:field-definition
:object}},
:override {:locations #{:field-definition}, :args {:from {:type (non-null String)}}},
:extends {:locations #{:interface :object}}}}
43 changes: 43 additions & 0 deletions dev-resources/edn-federation.sdl
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
schema {
query: Query
mutation: Mutation
subscription: Subscription
}

directive @extends on INTERFACE | OBJECT
directive @key(fields: _FieldSet!, resolvable: Boolean = true) on INTERFACE | OBJECT
directive @external on FIELD_DEFINITION
directive @shareable on FIELD_DEFINITION | OBJECT
directive @requires(fields: _FieldSet!) on FIELD_DEFINITION
directive @link(url: String, as: String, for: link__Purpose, import: [link__Import]) on SCHEMA
directive @provides(fields: _FieldSet!) on FIELD_DEFINITION
directive @override(from: String!) on FIELD_DEFINITION
directive @inaccessible on ENUM | INPUT_FIELD_DEFINITION | INTERFACE | INPUT_OBJECT | ENUM_VALUE | SCALAR | ARGUMENT_DEFINITION | UNION | FIELD_DEFINITION | OBJECT

scalar _Any
scalar _FieldSet
scalar link__Import

enum link__Purpose{
SECURITY
EXECUTION
}

type _Service{
sdl: String!
}
type User @key(fields: "id") {
id: Int!
name: String!
}
type Query{
user_by_id(id: Int!): User
}
type Account @key(fields: "acct_number") {
acct_number: String!
name: String!
}
type Product @key(fields: "upc") @extends {
upc: String!
reviewed_by: User
}
5 changes: 0 additions & 5 deletions docs/federation/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@ service-spanning queries apart and build an overall query plan.
Lacinia has been extended, starting in 0.38.0, to support acting as an implementing service; there is no plan
at this time to act as a gateway.

.. warning::

At this time, only a schema defined with the :doc:`Schema Definition Language </schema/parsing>`, can be extended to act as
a service implementation.

Essentially, federation allows a set of services to each provide their own types, queries, and mutations, and organizes things so that
each service can provide additional fields to the types provided by the other services.

Expand Down
Loading