Expose nested JSON Schema export warnings from the root model

オープン
#262 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
68/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
活発
技術スタック
dart

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
Dart
スター
64
フォーク
3
平均マージ
17時間 32分
マージ済み PR(30日)
33

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

btwld/ack のほかの issue

btwld/ack の issue をすべて見る

似ている issue

Dart の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。