-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[DocumentationRequest] Machine Readable Version of Standard using OData CSDL Schema #72
Comments
As a side note: from this one could probably also generate an OpenAPI interface using this official stylesheet: https://tools.oasis-open.org/version-control/browse/wsvn/odata/trunk/spec/examples/V4-CSDL-to-OpenAPI.xsl which would accelerate adoption |
Hi Till, |
It seems there was an actual effort on this reading the standard: "Things API does not follow the OData Common Schema Definition Language and as a result does not follow its metadata service entity model. Thus, SensorThings API should not be seen as an OData compliant API. SensorThings API’s future work will explore possible harmonization between SensorThings API and OData." I am not familiar enough to understand what are the current show stoppers of making SensorThings OData compliant. Maybe someone of the editors could comment on this and the possible needed changes in the standard. |
The reason was at the time STA about to be published, CSDL was introduced in a later version of OData. As a result it wasn't included in STA and listed as a future work. |
I just had a quick look through the CSDL Schema definition, looking for those points that might cause issues.
The only possible problem that I see is:
|
I'd like to add a +1 for this. We have sensor data served via FROST API. I tried to use the python-odata library to query it, but was unable to instantiate a Client class because it relies on the OData metadata file: >>> client = pyodata.Client(SERVICE_URL, requests.Session())
HttpError: Metadata request failed, status code: 404, body:
b'{"code":404,"type":"error","message":"Not a valid id: Path is not valid."}' It was looking for the metadata file at: |
If you have experience with OData, could you create a |
Unfortunately, I don't have experience with OData aside from hand-written FROST Server requests. Today was my first attempt at connecting via a dedicated library. |
As an experiment I've implemented OData 4.0 and 4.01 for a STA endpoint. Due to differences in the encoding, I've given these versions different URLs, to make it clear what is being used: https://ogc-demo.k8s.ilt-dmz.iosb.fraunhofer.de/ODATA_4.0/ In theory, one could use the same URL for STA and different OData versions, since OData defines a header for clients to request a maximum OData version, but for these experiments I prefer making things explicit. If you're still interested, can you try out these endpoints? |
Did you have to modify the actual API or is this just implementing the "/$metadata" URL? |
It does modify the API slightly, since there are small differences in the JSON keys for generated properties, as documented in #136. |
Thanks for doing this, I am interested to try it. I had a quick attempt to connect, but it turns out that the "Enterprise-ready Python OData client" created by SAP only supports OData V2 and didn't like the JSON output. I hadn't spotted that this library was so out-of-date before. It seems to be the most established Python OData framework on GitHub, too. I'll have a look at other clients later. |
Yes, @hylkevds, first of all many thx!! @volcan01010 : have you tried this PR SAP/python-pyodata#77 ? |
Actually I tried using both excel 2016 and linqpad 6/7 and I strangely get SSL validation errors on both. However, this error seems not uncommon: meancrazy/LINQPadOData4#26. If I accept an invalid certificate, I get Data at root level is invalid. Line 1, position 1 in Linqpad. I think it expected XML rather than the returned json. If I modify the request header for |
I'm pretty sure Excel 2016 only supports OData 3.0, not 4.0. OData 3.0 only has XML. |
The error, however, is from meancrazy/LINQPadOData4 which uses Microsoft's OData v4 Client Code Generator. |
What headers does it send in its request to the landing page? |
I used 4.0. It pretty much sends no headers at all (except for the path). So I used mitm proxy to ask for XML, which seems to be the expected default also for the 4.0 client. There seems to be an easy way to validate metadata in .net btw (haven't tried): https://github.com/cmshawns/ODataValidator/blob/master/ODataValidator/ODataValidator.cs |
Many tools /particularly all the Microsoft .NET LINQ Support) won't work on SensorThings Services without the related CSDL Schema available on $metadata.
As this is a static file and SensorThings is OData compliant it should be possible to provide it as an annex to the standard.
The text was updated successfully, but these errors were encountered: