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

Calling an action with optional parameter not present in payload should not fail even if not nullable #1216

Closed
VatroslavSrzic opened this Issue Jul 24, 2018 · 1 comment

Comments

Projects
None yet
2 participants
@VatroslavSrzic

VatroslavSrzic commented Jul 24, 2018

When there is an OData Action that accepts optional parameters that are not nullable and client sends request without that parameter in requests payload, an ODataException is thrown with message:
"One or more parameters of the operation '<operation_name>' are missing from the request payload. The missing parameters are: <parameter_name>.".

However, I do not see anything illegal in not sending an optional parameter; regardless if it is nullable or not.

Assemblies affected

Microsoft.OData.Core 7.5.0.

Additional detail

The trouble seems to be in ODataParameterReaderCore in method EnterScope(ODataParameterReaderState state, string name, object value) in place where missing parameters are checked and only bounding parameter is skipped, not the optional ones.
However, I am not sure that in this place you have information on if the parameter is optional or not (I do not see that info on IEdmOperationParameter.

Workaround

At present time I have decided to put all my optional parameters to be nullable too. I do not like it, but there are no major drawbacks either.

xuzhg added a commit to xuzhg/odata.net that referenced this issue Aug 2, 2018

xuzhg added a commit that referenced this issue Aug 2, 2018

@xuzhg

This comment has been minimized.

Member

xuzhg commented Aug 3, 2018

Merged

@xuzhg xuzhg closed this Aug 3, 2018

xuzhg added a commit to xuzhg/odata.net that referenced this issue Sep 5, 2018

xuzhg added a commit that referenced this issue Sep 5, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment