Documentation ¶
Index ¶
- Variables
- type DirectiveDefinitionsMap
- type DirectiveMetadata
- type DirectiveUsages
- type DirectiveUsagesPerField
- type DirectiveUsagesPerSubgraph
- type DirectiveUsagesPerType
- type DirectiveUsagesPerTypeEntity
- type ExternalFieldDefinition
- type FederationDirective
- type FederationDirectiveMap
- type FederationField
- type FederationFieldMap
- type FederationMetadata
- type FederationType
- type FederationTypeMap
- type KeyDirectivesMap
- type ServiceDefinition
- type ServiceName
- type ServiceNameToKeyDirectivesMap
- type TypeDefinitionEntity
- type TypeDefinitionsMap
- type TypeToServiceEntity
- type TypeToServiceMap
- type ValueTypes
Constants ¶
This section is empty.
Variables ¶
var CoreDirective = &ast.DirectiveDefinition{ Name: "core", Arguments: ast.ArgumentDefinitionList{ &ast.ArgumentDefinition{ Name: "feature", Type: &ast.Type{ NamedType: "String", NonNull: true, }, }, &ast.ArgumentDefinition{ Name: "as", Type: &ast.Type{ NamedType: "String", }, }, &ast.ArgumentDefinition{ Name: "for", Type: &ast.Type{ NamedType: CorePurpose.Name, }, }, }, Locations: []ast.DirectiveLocation{ ast.LocationSchema, }, IsRepeatable: true, Position: blankPos, }
var CorePurpose = &ast.Definition{ Kind: ast.Enum, Name: "core__Purpose", EnumValues: ast.EnumValueList{ &ast.EnumValueDefinition{ Name: "EXECUTION", Description: "`EXECUTION` features provide metadata necessary to for operation execution.", }, &ast.EnumValueDefinition{ Name: "SECURITY", Description: "`SECURITY` features provide metadata necessary to securely resolve fields.", }, }, Position: blankPos, }
var FieldSetScalar = &ast.Definition{ Kind: ast.Scalar, Name: "join__FieldSet", Position: blankPos, }
var JoinGraphDirective = &ast.DirectiveDefinition{ Name: "join__graph", Arguments: ast.ArgumentDefinitionList{ &ast.ArgumentDefinition{ Name: "name", Type: &ast.Type{ NamedType: "String", NonNull: true, }, }, &ast.ArgumentDefinition{ Name: "url", Type: &ast.Type{ NamedType: "String", NonNull: true, }, }, }, Locations: []ast.DirectiveLocation{ ast.LocationEnumValue, }, Position: blankPos, }
Functions ¶
This section is empty.
Types ¶
type DirectiveDefinitionsMap ¶
type DirectiveDefinitionsMap map[string]map[string]*ast.DirectiveDefinition
Map of all directive definitions to eventually be passed to extendSchema original: [name: string]: { [serviceName: string]: DirectiveDefinitionNode };
type DirectiveMetadata ¶
type DirectiveMetadata struct {
DirectiveUsagesPerSubgraph DirectiveUsagesPerSubgraph
}
func (*DirectiveMetadata) HasUsage ¶
func (dm *DirectiveMetadata) HasUsage(directiveName string) bool
visit the entire map for any usages of a directive
type DirectiveUsagesPerField ¶
type DirectiveUsagesPerField map[string]DirectiveUsages
field name => directive name => usages
type DirectiveUsagesPerSubgraph ¶
type DirectiveUsagesPerSubgraph map[string]DirectiveUsagesPerType
subgraph name => DirectiveUsagesPerType
type DirectiveUsagesPerType ¶
type DirectiveUsagesPerType map[string]*DirectiveUsagesPerTypeEntity
type name => { directives: DirectiveUsages, fields: DirectiveUsagesPerField }
type DirectiveUsagesPerTypeEntity ¶
type DirectiveUsagesPerTypeEntity struct { Directives DirectiveUsages Fields DirectiveUsagesPerField }
type ExternalFieldDefinition ¶
type ExternalFieldDefinition struct { Field *ast.FieldDefinition ParentTypeName string ServiceName string }
type FederationDirective ¶
type FederationDirective struct {
DirectiveDefinitions map[string]*ast.DirectiveDefinition
}
type FederationDirectiveMap ¶
type FederationDirectiveMap map[*ast.DirectiveDefinition]*FederationDirective
func (FederationDirectiveMap) Get ¶
func (fdm FederationDirectiveMap) Get(node *ast.DirectiveDefinition) *FederationDirective
type FederationField ¶
type FederationField struct { ServiceName ServiceName ParentType *ast.Definition Provides ast.SelectionSet Requires ast.SelectionSet BelongsToValueType bool DirectiveUsages DirectiveUsages }
type FederationFieldMap ¶
type FederationFieldMap map[*ast.FieldDefinition]*FederationField
func (FederationFieldMap) Get ¶
func (ffm FederationFieldMap) Get(node *ast.FieldDefinition) *FederationField
type FederationMetadata ¶
type FederationMetadata struct { FederationTypeMap FederationTypeMap FederationFieldMap FederationFieldMap FederationDirectiveMap FederationDirectiveMap }
func ComposeAndValidate ¶
func ComposeAndValidate(ctx context.Context, serviceList []*ServiceDefinition) (schema *ast.Schema, supergraphSDL string, matadata *FederationMetadata, err error)
type FederationType ¶
type FederationType struct { ServiceName ServiceName Keys ServiceNameToKeyDirectivesMap Externals map[string][]*ExternalFieldDefinition IsValueType bool DirectiveUsages DirectiveUsages }
type FederationTypeMap ¶
type FederationTypeMap map[*ast.Definition]*FederationType
func (FederationTypeMap) Get ¶
func (ftm FederationTypeMap) Get(node *ast.Definition) *FederationType
type KeyDirectivesMap ¶
type KeyDirectivesMap map[string]ServiceNameToKeyDirectivesMap
Map of types to their key directives (maintains association to their services)
Example resulting KeyDirectivesMap shape:
const keyDirectives = { Product: { serviceA: ["sku", "upc"] serviceB: ["color {id value}"] // Selection node simplified for readability } }
original: [typeName: string]: ServiceNameToKeyDirectivesMap;
type ServiceDefinition ¶
type ServiceDefinition struct { TypeDefs *ast.SchemaDocument Name string URL string // optional }
type ServiceName ¶
type ServiceName = string
type ServiceNameToKeyDirectivesMap ¶
type ServiceNameToKeyDirectivesMap map[string][]ast.SelectionSet
original: [serviceName: string]: ReadonlyArray<SelectionNode>[] | undefined;
type TypeDefinitionEntity ¶
type TypeDefinitionEntity struct { ServiceName string Definition *ast.Definition }
type TypeDefinitionsMap ¶
type TypeDefinitionsMap map[string][]*TypeDefinitionEntity
Map of all type definitions to eventually be passed to extendSchema
type TypeToServiceEntity ¶
type TypeToServiceMap ¶
type TypeToServiceMap map[string]*TypeToServiceEntity
A map of base types to their owning service. Used by query planner to direct traffic. This contains the base type's "owner". Any fields that extend this type in another service are listed under "extensionFieldsToOwningServiceMap". extensionFieldsToOwningServiceMap are in the format { myField: my-service-name }
Example resulting typeToServiceMap shape:
const typeToServiceMap = { Product: { serviceName: "ProductService", extensionFieldsToOwningServiceMap: { reviews: "ReviewService", // Product.reviews comes from the ReviewService dimensions: "ShippingService", weight: "ShippingService" } } }
original: [typeName: string]: { owningService?: string; extensionFieldsToOwningServiceMap: { [fieldName: string]: string }; };
type ValueTypes ¶
type ValueTypes []string
A set of type names that have been determined to be a value type, a type shared across at least 2 services. original: type ValueTypes = Set<string>;
func (ValueTypes) Has ¶
func (vts ValueTypes) Has(name string) bool