Allow letting value field empty for numeric ports #854
+17
−10
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Unlike on v3, on v4 you cannot let the value field empty for numeric ports. You get this parsing error:
I think v3 behavior was nicer cause it gives you a clean way to make your numeric fields optional:
empty string -> null_optional value -> use your default
On v4 you need to provide a value that you know is a default (e.g. nan), but nobody else will know. This is awkward and different from string values, where empty string is allowed.
Disclaimer: I didn't dig deep into the code, so not sure that this is the best implementation. It just replicate v3 behavior.