Skip to content

Commit

Permalink
fix: Send context to SDL generation / don't cache (#45)
Browse files Browse the repository at this point in the history
* fix: Send context to SDL generation / don't cache

- Forwards query context during SDL generation
- Removes SDL caching mechanism as visibility rules can change depending
  on the client

* fix: Bump circle

* fix: Add nil default to context
  • Loading branch information
cmschuetz authored Jan 29, 2020
1 parent a741914 commit 9a29be1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
8 changes: 3 additions & 5 deletions lib/apollo-federation/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,9 @@ def to_graphql
super
end

def federation_sdl
@federation_sdl ||= begin
document_from_schema = FederatedDocumentFromSchemaDefinition.new(self)
GraphQL::Language::Printer.new.print(document_from_schema.document)
end
def federation_sdl(context: nil)
document_from_schema = FederatedDocumentFromSchemaDefinition.new(self, context: context)
GraphQL::Language::Printer.new.print(document_from_schema.document)
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/apollo-federation/service_field.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module ServiceField
field(:_service, Service, null: false)

def _service
{ sdl: context.schema.class.federation_sdl }
{ sdl: context.schema.class.federation_sdl(context) }
end
end
end

0 comments on commit 9a29be1

Please sign in to comment.