Add signal form config option to process async validation even when sync errors are present
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Facilidade para iniciantes
- 48/100
- Tipo de issue
- Funcionalidade
- Clareza
- Razoavelmente clara
- Status de atividade
- Ativa
- Stack de tecnologia
- angular, typescript
- Domínio
- frontend
Direção de pesquisa
Start in the Angular forms package by tracing FormOptions, validateStandardSchema, and validateAsync. Review the existing synchronous and asynchronous validation tests to determine where the proposed processAsyncValidators behavior belongs. Done means the option supports both the default whenSyncValid behavior and always, with tests covering async results when synchronous errors are present.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
Which @angular/* package(s) are relevant/related to the feature request?
forms
Description
My use case involves validateStandardSchema. We have Zod schemas defined for our forms, and we are validating the forms with them using validateStandardSchema. We also have some of Angular's required() validators thrown in as well. The trouble is, we have a reused sub-schema that we need to add async validation to. This async Zod validation at some of the form leaf nodes (via async .superRefine() calls) causes the entire schema to return a promise instead of a synchronous value, and as such, Angular ignores the promise value whenever the form has other sync errors from the required() validators. To make matters worse, the Zod async validation is still run, but Angular is dropping the results on the floor.
So, my proposal is this: would it be possible/acceptable to add a configuration option to either the form itself, or to validateStandardSchema, to not ignore these async errors? I understand the reasoning to avoid expensive async validators when possible, but in this scenario, they aren't even being avoided, just ignored.
Proposed solution
Add a configuration option to FormOptions, called something like "processAsyncValidators", with possible values of "whenSyncValid" (default), and "always", which is consumed in validateAsync().
Alternatives considered
- Create separate sync and async schemas: rejected because the composable schema structure would have to be duplicated unnecessarily
- Create more granular, field-level schemas: rejected because this violates the concept of having a single standard schema for a form, and shifts complexity from the schema to the Angular component
- Linguagem predominante
- TypeScript
- Estrelas
- 101k
- Forks
- 28.1k
- Merge médio
- 2d 8h
- PRs com merge (30d)
- 292
Guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de angular/angular
-
area: docs
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
-
area: forms forms: signals
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
-
area: docs gemini-triaged
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 70/100
-
area: forms forms: signals
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
-
area: docs area: forms
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
Todas as issues de angular/angular
Issues semelhantes
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 65/100
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
-
bug v2
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
modelcontextprotocol/inspector#2458 · 1 comentário ·
-
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 75/100
railmapgen/rmp-gallery#4068 ·
-
Mend: dependency security vulnerability status: needs triage 🕵️♀️
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 70/100
carbon-design-system/ibm-products#9907 ·