You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@olingo.apache.org by "Roger Che (JIRA)" <ji...@apache.org> on 2018/04/26 06:10:00 UTC

[jira] [Created] (OLINGO-1261) The target binding type should be available from Navigation Property

Roger Che created OLINGO-1261:
---------------------------------

             Summary: The target binding type should be available from Navigation Property
                 Key: OLINGO-1261
                 URL: https://issues.apache.org/jira/browse/OLINGO-1261
             Project: Olingo
          Issue Type: Bug
          Components: odata4-server
    Affects Versions: (Java) V4 4.4.0
            Reporter: Roger Che
         Attachments: Zoo.xml

The Navigation Property can declare with a (collection of) parent type and bind to a sub type EntitySet. See 

org.apache.olingo.client.core.metadatavalidator.EdmTypeValidator#validateNavigationBindingPaths

But in the runtime, the Navigation Property always return a type of the declare type but not the binding type. This can cause problem when the Navigation Property is declare with a parent type while in the EntitySet/Singleton it is bind to the child type Entity Set. See the uploaded Zoo.xml. The problems includes.
 # When sending GET request to [http://localhost:8080/zoo.svc/Zoo/Animals.] I expect to get the binding type 'Tiger' for UriResourceNavigation 'Animals'. Because in the metadata, the Singleton Zoo bind the Animals to Collection(Tiger). But there is no such API. I can only use the API UriResourceNavigation#getProperty()#getType() to get the declaring type 'Animal'. Since I cannot get the actual binding type. I cannot serialize the entity with a Tiger type which includes the property 'Weight'
 # When sending POST request to do the deep insert to [http://localhost:8080/zoo.svc/Zoo/Animals.] with the payload \{"Id":"tiger-002", "Name": "test test", "Weight": 150}. I still expect to get binding type 'Tiger' for UriResourceNavigation 'Animals'. So that i can deserialize the bod to an entity of Tiger. But I can only get the type 'Animal' for UriResourceNavigation 'Animals' from existing API. And it will throw me an exception telling that 
"'Weight' can not be mapped as a property or an annotation." 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)