[Feature Request] support subtyping of primitives
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 20/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bastante claro
- Estado de actividad
- Tranquilo
- Stack tecnológico
- typescript
- Área
- backend
Línea de trabajo
Design-level request: decide how primitive subtypes are declared and how validation attributes reach array elements, then carry that through ZModel parsing, validation and generated TypeScript types. Begin with how type declarations and @length-style attributes are parsed today and how scalar arrays are typed, and resolve the open question about nullable elements (PostTag?[]). Done means type PostTag { value String @length(1, 5) } used as PostTag[] validates each element, with tests covering arrays and nullability.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
Currently, it is not possible to validate elements of scalar arrays:
model Post {
tags String[] @length(1, 5) // what if I wanted a tag itself to be between 1 and 5 characters?
}
Describe the solution you'd like
A clear and concise description of what you want to happen.
Allow subtyping of primitives so that validation attributes can be applied to them, then referenced as the element type of an array.
type PostTag {
value String @length(1, 5)
}
model Post {
value PostTag[]
}
The above method wouldn't require changes to the schema language grammar. However, I will still note that the following syntax could be more intuitive to some because it doesn't use the implicit value property like the above, and is more like a type alias.
type PostTag = String @length(1, 5)
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Validate in application code. But then there is some validation occurring as part of the schema definition and some happening elsewhere. It would be nice to centralize it.
Additional context
Add any other context or screenshots about the feature request here.
Open questions:
-
Nullable array elements
These (
String?[]) are not currently allowed. Would these subtypes be forced as non-nullable, and required to be marked as nullable at the usage site (PostTag?)?
- Lenguaje dominante
- TypeScript
- Estrellas
- 2.9k
- Forks
- 157
- Merge medio
- 11 h 42 min
- PR fusionados (30 d)
- 20
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de zenstackhq/zenstack
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
zenstackhq/zenstack#2873 ·
Los mantenedores suelen responder en 1 día
-
runtime
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
zenstackhq/zenstack#2868 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
zenstackhq/zenstack#2694 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 68/100
zenstackhq/zenstack#2659 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
zenstackhq/zenstack#2542 · 1 comentario ·
Los mantenedores suelen responder en 1 día
Todos los issues de zenstackhq/zenstack
Issues similares
-
bug(sight): the dashboard's text truncations split surrogate pairs and show broken charactersAbiertocomponent:sight
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
agentic-os-org/ANOLISA#6738 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
bug Durable Agents Observability (AI Telemetry) status: needs triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
mastra-ai/mastra#26470 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
paperclipai/paperclip#15630 ·
Los mantenedores suelen responder en 1 día
-
[good first issue, hacktoberfest] ⛩️ Add new Theme: Sakura Latte (good-first-issue)Posiblemente ocupada @PGrayCS la tomó hoy. Abiertocommunity first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Dificultad 1/5 1-3 horas Aptitud para principiantes 78/100
lingdojo/kana-dojo#31937 · 1 comentario · 5 reacciones ·
Los mantenedores suelen responder en 1 día
-
feature/cohorts feature/feature-flags team/feature-flags
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
Los mantenedores suelen responder en 1 día