Skip to content

#124 make type detector smarter#138

Merged
vanlooverenkoen merged 15 commits into
masterfrom
#124-make-type-detector-smarter
Aug 30, 2023
Merged

#124 make type detector smarter#138
vanlooverenkoen merged 15 commits into
masterfrom
#124-make-type-detector-smarter

Conversation

@jorre127

Copy link
Copy Markdown
Contributor

closes #124

@vanlooverenkoen vanlooverenkoen left a comment

Copy link
Copy Markdown
Contributor

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.

Comment thread CHANGELOG.md Outdated
@@ -1,7 +1,10 @@
# Changelog
## [6.4.0] - 2023-08-14

Copy link
Copy Markdown
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

Comment thread README.md Outdated
roles: List<string>
customProperties: Map<String, Property>?
```
since 6.4.0 inline types are supported now even when adding extra configuration:

Copy link
Copy Markdown
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

Comment thread example/model_generator/config.yaml Outdated
non_final: true
dateChange:
type: datetime
type: datetime?

Copy link
Copy Markdown
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?

expect(simpleDateTime.isRequired, false);
});

test('Test required not definable anymore', () {

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

Fix readme

Comment thread example/model_generator/config.yaml Outdated
Comment thread example/model_generator/config.yaml
Field getField(String name, YamlMap property,
{required bool disallowNullForDefaults}) {
try {
final required =

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

Comment thread test/writer/model_reader_test.dart Outdated
expect(requiredString1.type, isA<StringType>());
expect(requiredString1.isRequired, true);

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

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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