Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

179
Vistas
Accepting Int or String in graphQL schema

I have an input type in my apollo graphql schema, My schema looks like:

input Score {
    total: String! // The input we recieve from the user might be a string or an int.
    
  }

So, I want the total to be an string or int. How can I implement that? Should I use custom scalar types or is there any better way?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Well your Schema can be as it are!

typeDefs= gql`
input Score{
   total: String!
}

type mutation{
   totalBE: (input: Score)
}
`
Query:{
    totalBe: ScoreBe(_,param);

}

but in the back end function resoolver

resoolvers = {
ScoreBe(paramArgs):{
   score = paramArgs.input.total;
      //deal with it as String and Interger at the same time in your middleware or backEnd Technollogy. (is most easy here).

}
}

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda