2021-09-16 03:23:05 +00:00
|
|
|
import 'package:logging/logging.dart';
|
|
|
|
import 'package:belatuk_json_serializer/belatuk_json_serializer.dart';
|
|
|
|
import 'package:stack_trace/stack_trace.dart';
|
|
|
|
|
|
|
|
void printRecord(LogRecord rec) {
|
|
|
|
print(rec);
|
|
|
|
if (rec.error != null) print(rec.error);
|
|
|
|
if (rec.stackTrace != null) print(Chain.forTrace(rec.stackTrace!).terse);
|
|
|
|
}
|
|
|
|
|
|
|
|
class SampleNestedClass {
|
|
|
|
String? bar;
|
|
|
|
|
2023-03-26 01:38:56 +00:00
|
|
|
SampleNestedClass([this.bar]);
|
2021-09-16 03:23:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
class SampleClass {
|
|
|
|
String? hello;
|
|
|
|
List<SampleNestedClass> nested = [];
|
|
|
|
|
2023-03-26 01:38:56 +00:00
|
|
|
SampleClass([this.hello]);
|
2021-09-16 03:23:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@WithSchemaUrl(
|
|
|
|
"http://raw.githubusercontent.com/SchemaStore/schemastore/master/src/schemas/json/babelrc.json")
|
|
|
|
class BabelRc {
|
|
|
|
List<String> presets;
|
|
|
|
List<String> plugins;
|
|
|
|
|
2023-03-26 01:38:56 +00:00
|
|
|
BabelRc({this.presets = const [], this.plugins = const []});
|
2021-09-16 03:23:05 +00:00
|
|
|
}
|
|
|
|
|
2023-03-26 01:38:56 +00:00
|
|
|
@WithSchema({
|
2021-09-16 03:23:05 +00:00
|
|
|
r"$schema": "http://json-schema.org/draft-04/schema#",
|
|
|
|
"title": "Validated Sample Class",
|
|
|
|
"description": "Sample schema for validation via JSON God",
|
|
|
|
"type": "object",
|
2023-03-26 01:38:56 +00:00
|
|
|
"hello": {"description": "A friendly greeting.", "type": "string"},
|
|
|
|
"nested": {
|
2021-09-16 03:23:05 +00:00
|
|
|
"description": "A list of NestedSampleClass items within this instance.",
|
|
|
|
"type": "array",
|
2023-03-26 01:38:56 +00:00
|
|
|
"items": {
|
2021-09-16 03:23:05 +00:00
|
|
|
"type": "object",
|
2023-03-26 01:38:56 +00:00
|
|
|
"bar": {"description": "Filler text", "type": "string"}
|
2021-09-16 03:23:05 +00:00
|
|
|
}
|
|
|
|
},
|
2023-03-26 01:38:56 +00:00
|
|
|
"required": ["hello", "nested"]
|
2021-09-16 03:23:05 +00:00
|
|
|
})
|
|
|
|
class ValidatedSampleClass {}
|