Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

619
Visualizações
When Stitching using HotChocolate, How Can A Remote Schema's Type Be Renamed?

Here's my scenario. I have a GraphQL gateway that stitches a dozen or so remote schemas together, using the following code:

services.AddHttpClient(schema.TypeName, c => c.BaseAddress = new Uri(schema.Url));
public virtual void Add(IRequestExecutorBuilder builder, bool ignoreRootTypes = true)
{
    var type = this.GetType();
    builder.AddRemoteSchema(type.Name, ignoreRootTypes);
}

Assume that the remote schemas are immutable. One of the remote schemas has a type called Name. This appears to be a reserved keyword, because during stitching, I get the exception:

For more details look at the Errors property.

  1. An item with the same key has already been added. Key: Name

I can correct this error by modifying the Name type of the remote service to be something like PersonName, however, as I mentioned above, these external schemas should be immutable.

Is there a way to rename a restricted type before this exception is thrown at the Gateway level?

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

Add a call to RenameType:

public virtual void Add(IRequestExecutorBuilder builder, bool ignoreRootTypes = true)
{
    var type = this.GetType();
    builder.AddRemoteSchema(type.Name, ignoreRootTypes);
    builder.RenameType("Name", "PersonName", type.Name);
}

This will rename the incoming type from your remote schema to something else.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda