Relevant Packages
@apollo/federation v0.33.3
@apollo/subgraph 0.1.2
To support the @contact directive, a schema element must be defined. When building a schema using buildSubgraphSchema and printing it via printSubgraphSchema the schema element is stripped without any directives applied.
Example Code
const { gql } = require("apollo-server");
const { buildSubgraphSchema } = require("@apollo/federation");
const { printSubgraphSchema } = require("@apollo/subgraph");
const typeDefs = gql`
directive @contact(
name: String!
url: String!
description: String!
) on SCHEMA
extend type Query {
hello: String
}
schema @contact(name: "hi", url: "https://hi.com", description: "hi") {
query: Query
}
`;
const schemaString = printSubgraphSchema(buildSubgraphSchema({ typeDefs }));
console.log(schemaString);
Expected Behavior
The expected value of schemaString.
directive @contact(name: String!, url: String!, description: String!) on SCHEMA
extend type Query {
_service: _Service!
hello: String
}
schema @contact(name: "hi", url: "https://hi.com", description: "hi") {
query: Query
}
Actual Behavior
directive @contact(name: String!, url: String!, description: String!) on SCHEMA
extend type Query {
_service: _Service!
hello: String
}
Relevant Packages
@apollo/federationv0.33.3@apollo/subgraph0.1.2To support the
@contactdirective, aschemaelement must be defined. When building a schema usingbuildSubgraphSchemaand printing it viaprintSubgraphSchemathe schema element is stripped without any directives applied.Example Code
Expected Behavior
The expected value of
schemaString.Actual Behavior