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

233
Views
¿Cómo restringir un tipo de varios tipos en la consulta de graphql?

Problema

Estoy implementando la paginación basada en cursores en graphql en el esquema de sincronización de aplicaciones de AWS. Quiero restringir el tipo dependiendo de la consulta. Por ejemplo, getBuildingsBySite no debería permitir ningún otro tipo que no sea Building. Actualmente, permite todos los tipos en la Unión. ¿Cómo se puede lograr esto?

 type Site { siteName: String address: String siteId: String! sitePicture: String siteImgUrl: String } type Floor { floorName: String accessPointsCount: Int unitsCount: Int wingName: String floorId: String! } type Building { buildingId: String! buildingName: String buildingAddress: String buildingImgUrl: String buildingImg: String } type PageInfo { hasNextPage: Boolean endCursor: Boolean } type Collection { edges: Edge pageInfo: PageInfo } type Edge { node: [Node] cursor: String } union Node = Site | Building | Floor type Query { getSites(first: Int, cursor: String): Collection getBuildingsBySite(first: Int, cursor: String, siteId: String!): Collection getFloorsByBuilding(first: Int, cursor: String, siteId: String!, buildingId: String!): Collection }

Consulta

 { getBuildingsBySite(first: 10, cursor: "xyz", siteId: "S1") { edges { node { ... on Site { siteName address address } ... on Building { buildingId buildingName } ... on Floor { floorId floorName } } } } }

Si existe algún enfoque mejor en AWS Appsync para la paginación, sugiéralo. Gracias

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!