Skip to content

Schema object is omitted when printed #1094

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
sMorm opened this issue Oct 15, 2021 · 2 comments
Closed

Schema object is omitted when printed #1094

sMorm opened this issue Oct 15, 2021 · 2 comments
Assignees

Comments

@sMorm
Copy link
Contributor

sMorm commented Oct 15, 2021

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
}
@lennyburdette
Copy link
Contributor

I think this requires two fixes to address:
#1096
apollographql/apollo-tooling#2457

@cpeacock
Copy link
Contributor

Hi there! I'm closing this issue because I believe with Trevor's fixes, these have been addressed in the older stable versions of the gateway. Please reopen if there's still something amiss.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants