Skip to content

#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

Merged
merged 15 commits into from
Aug 30, 2023

Conversation

jorre127
Copy link
Contributor

closes #124

Copy link
Contributor

@vanlooverenkoen vanlooverenkoen left a 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
Copy link
Contributor

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:
Copy link
Contributor

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

non_final: true
dateChange:
type: datetime
type: datetime?
Copy link
Contributor

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', () {
Copy link
Contributor

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

@vanlooverenkoen
Copy link
Contributor

Fix readme

@@ -180,8 +180,6 @@ class YmlGeneratorConfig {
Field getField(String name, YamlMap property,
{required bool disallowNullForDefaults}) {
try {
final required =
Copy link
Contributor

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);
}

expect(requiredString1.type, isA<StringType>());
expect(requiredString1.isRequired, true);

expect(optionalString2.type, isA<StringType>());
Copy link
Contributor

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);
Copy link
Contributor

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);
Copy link
Contributor

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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check the actual error

@vanlooverenkoen vanlooverenkoen merged commit 8feb918 into master Aug 30, 2023
@vanlooverenkoen vanlooverenkoen deleted the #124-make-type-detector-smarter branch August 30, 2023 08:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make the type detector even smarter
2 participants