schema2dart 1.0.2
schema2dart: ^1.0.2 copied to clipboard
Generate strongly typed Dart models from JSON Schema documents.
1.0.2 #
- Fix
defaultvalues on array properties whose item type is an enum or union (e.g. aList<InputModality>withdefault: ["text", "image"]): elements now convert through the item type (.fromJson(...)) instead of being emitted as raw untyped literals, which produced invalid Dart. Arrays containing only const-able literals still emitconst [...].
1.0.1 #
- Fix call sites for refs to unions with primitive variants (e.g.
string | intlike a JSON-RPCRequestId):ObjectTypeRef.deserializeInlineno longer casts the wire value to aMap, which threw at runtime for primitive values. The raw value is now passed to the union'sfromJson(dynamic). - Fix property keys containing
$(e.g.$schema): generated string literals now escape the dollar instead of emitting Dart interpolation that referenced the local variable being declared. - Both fixes are applied everywhere property keys are emitted: property access,
remaining.remove(...),keys.contains(...)heuristics, const-value matching, and validation-helper paths.
1.0.0 #
- Initial release.