Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: improve deserialization and production logic #172

Merged
merged 1 commit into from
Jun 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion lib/src/core/definitions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,3 @@ export "definitions/security/psk_security_scheme.dart";
export "definitions/security/security_scheme.dart";
export "definitions/thing_description.dart";
export "definitions/thing_model.dart";
export "definitions/validation/thing_description_schema.dart";
11 changes: 8 additions & 3 deletions lib/src/core/definitions/data_schema.dart
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,20 @@ class DataSchema {
Set<String>? parsedFields,
]) {
parsedFields = parsedFields ?? {};
final atType = json.parseArrayField<String>("@type", parsedFields);
final atType =
json.parseArrayField<String>("@type", parsedFields: parsedFields);
final title = json.parseField<String>("title", parsedFields);
final titles = json.parseMapField<String>("titles", parsedFields);
final description = json.parseField<String>("description", parsedFields);
final descriptions =
json.parseMapField<String>("descriptions", parsedFields);
final constant = json.parseField<Object>("constant", parsedFields);
final defaultValue = json.parseField<Object>("default", parsedFields);
final enumeration = json.parseField<List<Object>>("enum", parsedFields);
final enumeration = json.parseArrayField<Object?>(
"enum",
parsedFields: parsedFields,
minimalSize: 1,
);
final readOnly = json.parseField<bool>("readOnly", parsedFields);
final writeOnly = json.parseField<bool>("writeOnly", parsedFields);
final format = json.parseField<String>("format", parsedFields);
Expand Down Expand Up @@ -166,7 +171,7 @@ class DataSchema {
final List<DataSchema>? oneOf;

/// Restricted set of values provided as a [List].
final List<Object>? enumeration;
final List<Object?>? enumeration;

/// Indicates if a value is read only.
final bool? readOnly;
Expand Down
Loading
Loading