-
Notifications
You must be signed in to change notification settings - Fork 8
#124 make type detector smarter #138
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Write tests to check that the old implementation is not possible anymore.
CHANGELOG.md
Outdated
@@ -1,7 +1,10 @@ | |||
# Changelog | |||
## [6.4.0] - 2023-08-14 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Breaking change should be 7.0.0
README.md
Outdated
@@ -378,6 +378,32 @@ UserModel: | |||
roles: List<string> | |||
customProperties: Map<String, Property>? | |||
``` | |||
since 6.4.0 inline types are supported now even when adding extra configuration: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update version & the rest of this readme as well. So the readme matches the latest version
example/model_generator/config.yaml
Outdated
non_final: true | ||
dateChange: | ||
type: datetime | ||
type: datetime? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe better to already switch everything to String & DateTime instead of lowercase?
@@ -66,6 +66,50 @@ TestModel: | |||
expect(simpleDateTime.type, isA<DateTimeType>()); | |||
expect(simpleDateTime.isRequired, false); | |||
}); | |||
|
|||
test('Test required not definable anymore', () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also add tests for list & map with the correct config.
And also add test for the old config. -> that should expect an exception
Fix readme |
@@ -180,8 +180,6 @@ class YmlGeneratorConfig { | |||
Field getField(String name, YamlMap property, | |||
{required bool disallowNullForDefaults}) { | |||
try { | |||
final required = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe for this release do it llike this.
if( property.containsKey('required')){
throw ArgumentError('required is removed, follow the migration to version 7.0.0);
}
test/writer/model_reader_test.dart
Outdated
expect(requiredString1.type, isA<StringType>()); | ||
expect(requiredString1.isRequired, true); | ||
|
||
expect(optionalString2.type, isA<StringType>()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use same formatting as your TestModel
error = e; | ||
} | ||
|
||
expect(error, isNotNull); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check if the error is in fact related to the required:true so check the actual error not just isNotNull
} catch (e) { | ||
error = e; | ||
} | ||
expect(error, isNotNull); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check the actual error
} catch (e) { | ||
error = e; | ||
} | ||
expect(error, isNotNull); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check the actual error
closes #124