Florent Albert created OLINGO-1629: -------------------------------------- Summary: Non-nullable properties are not validated in Complex Type Key: OLINGO-1629 URL: https://issues.apache.org/jira/browse/OLINGO-1629 Project: Olingo Issue Type: Bug Components: odata4-server Affects Versions: Version (Java) V4 5.0.0, (Java) V4 4.10.0 Reporter: Florent Albert
When a ComplexType that has a structural property defined as "Nullable=false", the client can pass no value for those properties without the server returning an error (unlike structural properties on entities, or actions parameters). For example, given the following Complex Type and Unbound Action: {code:java} <Action Name="testRequiredComplexTypeAction" IsBound="false"> <Parameter Name="TheComplexType" Type="PTC.integ.test.RequiredComplexType" Nullable="false" /> <ReturnType Type="Edm.String" Nullable="false" /> </Action> {code} {code:java} <ComplexType Name="RequiredComplexType"> <Property Name="RequiredParam" Type="Edm.String" Nullable="false" /> </ComplexType> {code} # Calling POST /testRequiredComplexTypeAction with empty JSON body ("{}") correctly returns 400 with "The parameter 'TheComplexType' must not be null" # Calling POST /testRequiredComplexTypeAction with empty complex value "\{ TheComplexType:{} }" returns a 200 without any error even though it violates the EDM. The issue seems to be in the [Deserializer |https://github.com/apache/olingo-odata4/blob/master/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializer.java#L799]where the null check skips validation against the nullable facet on the EDM property. -- This message was sent by Atlassian Jira (v8.20.10#820010)