feat(upload): validation YAML côté serveur dès la sélection du fichier
- Nouvel endpoint POST /api/uploads/validate : validation en 3 niveaux (syntaxe js-yaml → détection type → asyncapi validate / redocly lint) - Extraction automatique de info.title/version/description pour pré-remplir le formulaire - Validation déclenchée immédiatement à la sélection, résultat affiché inline - Bouton "Suivant" désactivé pendant la validation et si le fichier est invalide - Sans fichier sélectionné, on peut toujours passer à l'étape 2 Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
This commit is contained in:
@@ -48,4 +48,24 @@ export class ApiService {
|
||||
upload(formData: FormData): Observable<ApiEntry> {
|
||||
return this.http.post<ApiEntry>('/api/uploads', formData);
|
||||
}
|
||||
|
||||
validate(formData: FormData): Observable<{
|
||||
valid: boolean;
|
||||
type: 'ASYNCAPI' | 'OPENAPI' | null;
|
||||
mainFile: string | null;
|
||||
title: string | null;
|
||||
version: string | null;
|
||||
description: string | null;
|
||||
errors: Array<{ file: string; message: string }>;
|
||||
}> {
|
||||
return this.http.post<{
|
||||
valid: boolean;
|
||||
type: 'ASYNCAPI' | 'OPENAPI' | null;
|
||||
mainFile: string | null;
|
||||
title: string | null;
|
||||
version: string | null;
|
||||
description: string | null;
|
||||
errors: Array<{ file: string; message: string }>;
|
||||
}>('/api/uploads/validate', formData);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user