sensinov / djane

Context information management for hustle-free data sharing
Eclipse Public License 2.0
15 stars 5 forks source link

Query examples in tutorial might be wrong #23

Open jmcanterafonseca opened 5 years ago

jmcanterafonseca commented 5 years ago

Dear folks,

Please check the hints provided here

https://github.com/FIWARE/dataModels/blob/master/specs/ngsi-ld_howto.md#api-examples

so that you can properly refine your query examples (and/or implementation) that are or might be wrong. Also it would be a good idea that you use real @context not @context at example.org, etc.

Happy to clarify if you need it

best

gghabri commented 5 years ago

Thanks for your remark. I have updated the query examples as well as the implementation to support content-length header. (commit: https://github.com/sensinov/djane/commit/88bd7242b965d80beba56f0e74bc0e5e7792be09)

jmcanterafonseca commented 5 years ago

:) I was not referring to the content-length header but to the fact that the @context used for the query (in the Link header) is the @context that should be used to render an entity and not the @context used when creating the Entity. Please check what it is said at

https://fiware-datamodels.readthedocs.io/en/latest/ngsi-ld_howto/index.html#api-examples

(Entity Retrieval or Query Entity)

jmcanterafonseca commented 5 years ago

so this issue should be reopen

gghabri commented 5 years ago

Thanks for the clarification. The tutorial examples (entity creation) are correct since the content-type header value is application/ld+json. NGSI-LD API standard :

If the request verb is POST or PATCH and the Content-Type header is "application/ld+json", then the associated @context shall be obtained from the input payload itself. If no @context can be obtained from the input payload, then an HTTP error response of type BadRequestData shall be raised. In any case, the presence of a JSON-LD Link header in the incoming HTTP request when the Content-Type header is "application/ld+json" shall result in an HTTP error response of type BadRequestData.

We will update the implementation to support the case when content-type header value is equal to application/json for POST and PATCH method. We will also manage the @context resolution in the case of GET and DELETE Requests.

jmcanterafonseca commented 5 years ago

Also you would need to review your tutorials to match the latest version of the specification, namely the Core @context should be the last element of the @context Array

see https://github.com/FIWARE/tutorials.Linked-Data