jld3103
2 years ago
18 changed files with 121 additions and 57 deletions
@ -0,0 +1,22 @@ |
|||||||
|
import 'package:dynamite/src/models/schema.dart'; |
||||||
|
import 'package:json_annotation/json_annotation.dart'; |
||||||
|
|
||||||
|
part 'header.g.dart'; |
||||||
|
|
||||||
|
@JsonSerializable() |
||||||
|
class Header { |
||||||
|
Header({ |
||||||
|
this.description, |
||||||
|
this.required, |
||||||
|
this.schema, |
||||||
|
}); |
||||||
|
|
||||||
|
factory Header.fromJson(final Map<String, dynamic> json) => _$HeaderFromJson(json); |
||||||
|
Map<String, dynamic> toJson() => _$HeaderToJson(this); |
||||||
|
|
||||||
|
final String? description; |
||||||
|
|
||||||
|
final bool? required; |
||||||
|
|
||||||
|
final Schema? schema; |
||||||
|
} |
@ -0,0 +1,34 @@ |
|||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND |
||||||
|
|
||||||
|
part of 'header.dart'; |
||||||
|
|
||||||
|
// ************************************************************************** |
||||||
|
// JsonSerializableGenerator |
||||||
|
// ************************************************************************** |
||||||
|
|
||||||
|
Header _$HeaderFromJson(Map<String, dynamic> json) { |
||||||
|
$checkKeys( |
||||||
|
json, |
||||||
|
allowedKeys: const ['description', 'required', 'schema'], |
||||||
|
); |
||||||
|
return Header( |
||||||
|
description: json['description'] as String?, |
||||||
|
required: json['required'] as bool?, |
||||||
|
schema: json['schema'] == null ? null : Schema.fromJson(json['schema'] as Map<String, dynamic>), |
||||||
|
); |
||||||
|
} |
||||||
|
|
||||||
|
Map<String, dynamic> _$HeaderToJson(Header instance) { |
||||||
|
final val = <String, dynamic>{}; |
||||||
|
|
||||||
|
void writeNotNull(String key, dynamic value) { |
||||||
|
if (value != null) { |
||||||
|
val[key] = value; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
writeNotNull('description', instance.description); |
||||||
|
writeNotNull('required', instance.required); |
||||||
|
writeNotNull('schema', instance.schema?.toJson()); |
||||||
|
return val; |
||||||
|
} |
Loading…
Reference in new issue