Skip to content
This repository has been archived by the owner on Sep 21, 2024. It is now read-only.

write_service_document() service document has 'uri' element instead of 'url' #21

Open
cberge opened this issue Feb 25, 2016 · 0 comments

Comments

@cberge
Copy link
Contributor

cberge commented Feb 25, 2016

Call to odata_message_writer::write_service_document() use odata_json_writer::serialize() to produce a JSON service document. Inside this document, the URLs elements are labelled "uri" (see bellow)

{
"kind":"EntitySet",
"name":"Categories",
"uri":"Categories"
}

But as stated in the following document : http://docs.oasis-open.org/odata/odata-json-format/v4.0/os/odata-json-format-v4.0-os.doc

"Each element MUST be a JSON object with at least two name/value pairs, one with name name containing the name of the entity set, function import, or singleton, and one with name url containing the URL of the entity set, which may be an absolute or a relative URL. It MAY contain a name/value pair with name title containing a human-readable, language-dependent title for the object."
With following example:

{ 
  "name": "Orders",
  "kind": "EntitySet",
  "url":  "Orders"
}

One way to fix this would be to modify include/odata/core/odata_json_writer.h
and change the value of
#define JSON_URI U("uri")
to
#define JSON_URI U("url")

But maybe it should be confusing...

The other solution consist in creating
#define JSON_URL U("url")
in include/odata/core/odata_json_writer.h
and modify src/core/odat_json_writer.cpp to replace
result[JSON_URI] = odata::utility::json::value::string(service_document_element->get_url());
by
result[JSON_URL] = odata::utility::json::value::string(service_document_element->get_url());

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant