Schema.fromJson constructor
Schema.fromJson(
- Object? j
Implementation
factory Schema.fromJson(Object? j) {
final json = j as Map<String, Object?>;
return Schema(
type: switch (json['type']) {
null => Type.$default,
Object $1 => Type.fromJson($1),
},
format: switch (json['format']) {
null => '',
Object $1 => decodeString($1),
},
title: switch (json['title']) {
null => '',
Object $1 => decodeString($1),
},
description: switch (json['description']) {
null => '',
Object $1 => decodeString($1),
},
nullable: switch (json['nullable']) {
null => false,
Object $1 => decodeBool($1),
},
enum$: switch (json['enum']) {
null => [],
List<Object?> $1 => [for (final i in $1) decodeString(i)],
_ => throw const FormatException('"enum" is not a list'),
},
items: switch (json['items']) {
null => null,
Object $1 => Schema.fromJson($1),
},
maxItems: switch (json['maxItems']) {
null => 0,
Object $1 => decodeInt64($1),
},
minItems: switch (json['minItems']) {
null => 0,
Object $1 => decodeInt64($1),
},
properties: switch (json['properties']) {
null => {},
Map<String, Object?> $1 => {
for (final e in $1.entries)
decodeString(e.key): Schema.fromJson(e.value),
},
_ => throw const FormatException('"properties" is not an object'),
},
required: switch (json['required']) {
null => [],
List<Object?> $1 => [for (final i in $1) decodeString(i)],
_ => throw const FormatException('"required" is not a list'),
},
minProperties: switch (json['minProperties']) {
null => 0,
Object $1 => decodeInt64($1),
},
maxProperties: switch (json['maxProperties']) {
null => 0,
Object $1 => decodeInt64($1),
},
minimum: switch (json['minimum']) {
null => null,
Object $1 => decodeDouble($1),
},
maximum: switch (json['maximum']) {
null => null,
Object $1 => decodeDouble($1),
},
minLength: switch (json['minLength']) {
null => 0,
Object $1 => decodeInt64($1),
},
maxLength: switch (json['maxLength']) {
null => 0,
Object $1 => decodeInt64($1),
},
pattern: switch (json['pattern']) {
null => '',
Object $1 => decodeString($1),
},
example: switch (json['example']) {
null => null,
Object $1 => Value.fromJson($1),
},
anyOf: switch (json['anyOf']) {
null => [],
List<Object?> $1 => [for (final i in $1) Schema.fromJson(i)],
_ => throw const FormatException('"anyOf" is not a list'),
},
propertyOrdering: switch (json['propertyOrdering']) {
null => [],
List<Object?> $1 => [for (final i in $1) decodeString(i)],
_ => throw const FormatException('"propertyOrdering" is not a list'),
},
default$: switch (json['default']) {
null => null,
Object $1 => Value.fromJson($1),
},
);
}