Skip to content

Add fromJson and toJson fields to JsonKey class #146

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 2 commits into from
May 9, 2018
Merged

Conversation

kevmoo
Copy link
Collaborator

@kevmoo kevmoo commented May 8, 2018

No description provided.

@kevmoo kevmoo mentioned this pull request May 8, 2018
@kevmoo kevmoo force-pushed the i137_convert branch 3 times, most recently from b58dd15 to d4edbe5 Compare May 9, 2018 18:03
@kevmoo kevmoo changed the title WIP: towards https://github.com/dart-lang/json_serializable/issues/137 Add fromJsonFunction and toJsonFunction fields to JsonKey class May 9, 2018
@kevmoo kevmoo requested a review from natebosch May 9, 2018 18:03
this.nullable,
this.includeIfNull,
this.ignore,
this.fromJsonFunction,
Copy link
Member

Choose a reason for hiding this comment

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

can we pick shorter names? fromJson and toJson would not be ambiguous in this context and I think matches with with toJson methods on an object.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ack.

nullable: obj.getField('nullable').toBoolValue(),
includeIfNull: obj.getField('includeIfNull').toBoolValue(),
ignore: obj.getField('ignore').toBoolValue());
if (obj == null) {
Copy link
Member

Choose a reason for hiding this comment

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

FWIW I liked the ternary conditional better, especially given the shortened form. I like if for when the side effect is meaningful and ternary for when the assignment is meaningful.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

made it even better...

toJsonName);
}

class ConvertDataImpl {
Copy link
Member

Choose a reason for hiding this comment

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

what is Impl adding for this name?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Impl to scream that this class shouldn't be in the public API.

But...whatever...

ConvertDataImpl(this.name, this.paramType);
}

class JsonKeyImpl extends JsonKey {
Copy link
Member

Choose a reason for hiding this comment

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

Can we find a more meaningful distinction from the parent class for this name? JsonKeyWithConversion or something?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ack

@kevmoo kevmoo changed the title Add fromJsonFunction and toJsonFunction fields to JsonKey class Add fromJson and toJson fields to JsonKey class May 9, 2018
@kevmoo kevmoo merged commit bb96ddc into master May 9, 2018
@kevmoo kevmoo deleted the i137_convert branch May 9, 2018 23:34
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.

2 participants