docs: public TypeDefinitionRegistry buildRegistry(Document document) {
          List<GraphQLError> errors = new ArrayList<>();
          TypeDefinitionRegistry typeRegistry = new TypeDefinitionRegistry();
          List<Definition> definitions = document.getDefinitions();
          for (Definition definition : definitions) {
              if (definition instanceof SDLDefinition) {
                  typeRegistry.add((SDLDefinition) definition).ifPresent(errors::add);
              } else {
                  errors.add(new NonSDLDefinitionError(definition));
              }
          }
          if (errors.size() > 0) {
              throw new SchemaProblem(errors);
          } else {
              return typeRegistry;
          }
      }