Expose nested JSON Schema export warnings from the root model

Aperta
#262 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
68/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
dart

Direzione di ricerca

Start with the schema model returned by toSchemaModel() and trace how warnings are stored on object properties. Add a regression test for a date bound on an object property, checking that recursive warnings retain their path while node-local warnings keeps its current meaning. Done when the root model exposes the nested Draft-7 warning and the test confirms its path.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Reproduction

Verified on Ack 2.0.0-beta.3 from main at b8eb8eb with Dart 3.14.0. In a Dart package with ack: ^2.0.0-beta.3, run:

import 'package:ack/ack.dart';

void main() {
  final schema = Ack.object({'at': Ack.datetime().min(DateTime.utc(2026))});
  print(schema.safeParse({'at': '2025-12-31T00:00:00Z'}).isFail);
  print(schema.toJsonSchema());
  final model = schema.toSchemaModel() as AckObjectSchemaModel;
  print(model.warnings.map((warning) => warning.code).toList());
  print(model.properties!['at']!.warnings.map((warning) => warning.code).toList());
}
Actual
  • The runtime rejects the out-of-range timestamp (true).
  • Draft-7 export emits at: {type: string, format: date-time} without the lower bound. This is expected; Draft-7 has no equivalent date bound.
  • The root's warnings is [], while the at property's warnings is [datetime_constraint_not_draft7]. An exporter that checks only the model it was handed doesn't see that part of the runtime contract was lost.
Suggested change

Expose a recursive allWarnings accessor that preserves each warning's path, or propagate child warnings to the root. An accessor would let warnings retain its existing node-local meaning. Add a regression test for a date bound on an object property.

Lingua principale
Dart
Stelle
64
Fork
3
Merge medio
17h 32m
PR unite (30g)
33

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di btwld/ack

Tutte le issue di btwld/ack

Issue simili

Altre issue su Dart

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.