RWS / odata

SDL OData Framework
https://sdl.github.io
Other
137 stars 58 forks source link

JSON response does not include Navigation Links #7

Open dineshgarg opened 8 years ago

dineshgarg commented 8 years ago

If the "Accept" Header is set to "application/json" then the navigation links are not included in the response. However, if the "Accept" header is not specified or it set to "application/xml" then a XML response is returned with the navigation links included.

{
  "@odata.context": "http://localhost:8080/example.svc/$metadata#topic/$entity",
  "@odata.id": "topic('Topic-1')",
  "id": "Topic-1",
  "topicName": "testTopic"
}

<?xml version="1.0" encoding="UTF-8"?>
<entry xmlns:metadata="http://docs.oasis-open.org/odata/ns/metadata" xmlns:data="http://docs.oasis-open.org/odata/ns/data" xmlns="http://www.w3.org/2005/Atom" metadata:context="http://localhost:8080/example.svc/$metadata#topic/$entity" xml:base="http://localhost:8080/example.svc">
    <id>http://localhost:8080/example.svc/topic('Topic-1')</id>
    <title></title>
    <summary></summary>
    <updated>2016-02-24T22:26:10.145Z</updated>
    <author>
        <name>SDL OData v4 framework</name>
    </author>
    **<link rel="edit" title="Topic" href="topic('Topic-1')"></link>
    <link rel="http://docs.oasis-open.org/odata/ns/related/message" type="application/atom+xml;type=feed" title="message" href="topic('Topic-1')/message"></link>
    <link rel="http://docs.oasis-open.org/odata/ns/relatedlinks/message" type="application/xml" title="message" href="topic('Topic-1')/message/$ref"></link>**
    <category scheme="http://docs.oasis-open.org/odata/ns/scheme" term="#SDL.OData.Example.Topic"></category>
    <content type="application/xml">
        <metadata:properties>
            <data:id>Topic-1</data:id>
            <data:topicName>testTopic</data:topicName>
        </metadata:properties>
    </content>
</entry>
ben-gineer commented 8 years ago

We have this on our backlog to resolve. Is this something blocking you right now?

dineshgarg commented 8 years ago

It is blocking but we have decided to use Olingo for now. However, I really liked the intuitiveness of the annotations based approach in SDL and the fact that it has a pretty neat integration with Spring. We could definitely consider moving to SDL once the issue is resolved.

Oregu commented 8 years ago

Important information on JSON specifics regarding links.

Oregu commented 8 years ago

@dineshgarg I expect implementing odata.metadata=full Accept header behavior will be overkill? :no_good:

dineshgarg commented 8 years ago

@Oregu Sounds good!