Closed IceOnFire closed 5 years ago
Hey @IceOnFire,
take a look at 8feb80a. I added a raw property to the oHandler, that does only the JSON parsing but does not remove the additional meta data. I will leave this defect open, because this needs some improvement. For example I do not like the property name raw
. It is not real raw data because it is already parsed to JSON. Maybe we need to properties, one parsed and one raw.
regards Jan
Personally I don't mind the term raw
: parsing is such a trivial and necessary activity that you could take it as an implicit step.
While studying the Flux/Redux architecture I stumbled upon the Flux Standard Action specification. Maybe we could take inspiration from there for the naming: data is stored in the payload
, metadata in a meta
property.
This leads me however to propose breaking changes: the data
array could be payload.results
, inlinecount
becomes payload.total
. Just thinking out loud.
Yeah I thought about this one as well. It is something we should change in the next version 0.3.0:
payload.data
- would rename this one because it could be one, or more results. Any better naming idea?payload.total
- only if inlinecount is setpayload.raw
- the raw datapayload.meta
- only the @ metadataNope, I can't come up with better ideas :grin:
Yes, I would like to see all those possible fields returned:
payload.data - would rename this one because it could be one, or more results. Any better naming idea? payload.total - only if inlinecount is set payload.raw - the raw data payload.meta - only the @ metadata
I looked inside o.js file and don't see any mention of "payload" or "payload.raw," etc.
Can you tell me where it is and an example of how to access that raw payload back?
Sorry, the raw property is just in the branch mentioned above. If you check that out you can use it by calling this.raw
. I will try to make a new version in a couple of days and include the raw
property there.
Hopefully we can get this code in that branch merged into Master, so when I do "git clone" on this repo, I'll get all these changes.
Also, will this.raw return me the RESPONSE HEADERS too?
this.raw
included in last release. https://github.com/janhommes/o.js/tree/v0.3.7
Hi @janhommes,
I'm not sure of what I'm about to say here, but when I perform a request to an OData service without specifying any page size I get an additional field in the response that tells me what to do next:
http://services.odata.org/V4/Northwind/Northwind.svc/Orders
Is there a way already to get this info inside the oHandler? How could we add it in case? Thanks in advance,
Antony