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

Allow non strings tobe nillable #265

Merged
merged 1 commit into from Feb 25, 2020
Merged

Allow non strings tobe nillable #265

merged 1 commit into from Feb 25, 2020

Conversation

rsunbury
Copy link

Description

Fixes issue with non-string fields (i.e. dates) not being able to be nilled.

Related issues

#263

  • connect to <link_to_referenced_issue>

Checklist

  • [x ] New tests added or existing tests modified to cover all changes
  • [x ] Code conforms with the style
    guide

@@ -60,6 +60,7 @@ class XMLHandler {
name = descriptor.qname.name;
let isSimple = descriptor.isSimple;
let attrs = null;
if (val === null && descriptor.isNillable) descriptor.type.name = 'string';
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Author

Choose a reason for hiding this comment

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

I originally looked at that, but there are other date things that are going on before the code gets to the line to check for null and nilable. I do agree that this seems sort of hacky, but the more I thought about it the more I came to the conclusion that if the field is nilable and the value is null, the code should really not care about the data type from there on out.

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree. Can we refactor the code a bit to cover nillable date?

Copy link
Author

Choose a reason for hiding this comment

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

My apologies, it looks like getting toSmlDateOrTime to pass back null did work, not sure what I did different the first time I tried it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Great. Can you revert this change then?

Copy link
Author

Choose a reason for hiding this comment

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

Done (I thought I has already but...well, it seems I am having a hell of a week).

@raymondfeng
Copy link
Contributor

@rsunbury Thank you. I cleaned up your commit history and pushed them back for the PR.

@raymondfeng raymondfeng merged commit d03d717 into loopbackio:master Feb 25, 2020
@raymondfeng
Copy link
Contributor

Released as strong-soap@1.22.1

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.

None yet

2 participants