Class ServiceSDLPrinter

java.lang.Object
com.apollographql.federation.graphqljava.printer.ServiceSDLPrinter

public final class ServiceSDLPrinter extends Object
graphql.schema.idl.SchemaPrinter wrapper that is used to generate SDL returned by the _service { sdl } query and is compatible with Federation v1 and v2 specs.
  • Method Details

    • generateServiceSDL

      @Deprecated(since="05/16/2024") public static String generateServiceSDL(graphql.schema.GraphQLSchema schema, boolean queryTypeShouldBeEmpty)
      Deprecated.
      Migrate to use Federation v2
      Generate service SDL compatible with Federation v1 specification.
      Parameters:
      schema - target schema
      queryTypeShouldBeEmpty - boolean indicating whether query type contains "fake" query that should be removed (at least a single query has to be present for graphql-java to consider it as a valid schema)
      Returns:
      SDL compatible with Federation v1
    • generateServiceSDLV2

      public static String generateServiceSDLV2(graphql.schema.GraphQLSchema schema)
      Generate service SDL compatible with Federation v2 specification.
      Parameters:
      schema - target schema
      Returns:
      SDL compatible with Federation v2