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

125
Views
Tipos de campos de esquema reutilizables de Sanity.io

Soy nuevo en Sanity.io. Me pregunto si hay alguna manera de optimizar mis códigos y reutilizar los campos en diferentes esquemas.

Estoy pensando algo como esto:

coches.ts:

 export default { name: 'cars', title: 'Cars', type: 'document', fields: [vehicleName] }

camiones.ts:

 export default { name: 'trucks', title: 'Trucks', type: 'document', fields: [vehicleName] }

nombrevehículo.ts:

 export const vehicleName = { name: 'name', title: 'Name', type: 'string', validation: Rule => Rule.required() }
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

 { title: 'Vehicle Names', name: 'vehicles', type: 'array', of: [ { type: 'reference', to: [ {type: 'cars'}, {type: 'trucks'} ] } ] }

Puede usar referencias para acceder a los automóviles y camiones en tantos esquemas diferentes como desee, lo que hace que su código sea reutilizable

 export default { name: 'trucks', title: 'Trucks', type: 'array', fields: [ { title: 'Names', name: 'names', type: 'reference', to: [{type: 'vechicleName'}] } ] }

La cordura es bidireccional

about 4 years ago · Juan Pablo Isaza Report
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!