Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

145
Views
Heredar resolutores de la interfaz de graphql con Apollo Server v3

Me gustaría heredar resolutores de una interfaz graphql.

Considere este esquema.

 const typeDefs = gql` interface Name { name: String! surname: String! } type Person implements Name { _id: ID! name: String! surname: String! } type Query { getPerson: Person! } }

Y estos resolutores:

 const queryResolver = { Name: { name: () => "John", surname: () => "Doe" }, Query: { getPerson: async (parent, args, context, info) => { return { _id: "1", }; }, } }

este es mi servidor

 const { ApolloServer } = require("apollo-server"); const typeDefs = require("./types"); const queryResolvers = require("./resolvers/query"); const resolvers = { Query: queryResolvers.Query, Name: queryResolvers.Name, }; try { const server = new ApolloServer({ typeDefs, resolvers, }); server.listen().then(({ url }) => { console.log(`Apollo server listening on ${url}`); }); } catch (e) { console.error(e); }

Me gustaría eso al consultar el servidor.

 query Query { getPerson { name surname } }

Obtengo a John Doe, ya que esperaría que Person herede los resolutores de Name .

En ApolloServer v.2 obtengo esta funcionalidad implementada a través inheritResolversFromInterfaces https://www.apollographql.com/docs/apollo-server/v2/api/graphql-tools/

No he podido encontrar un equivalente en ApolloServer v3.0

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!