[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: RE: [odata] RE: JSON as default format
Anil, I think that’s a great suggestion for a possible vocabulary. It would also smooth some of the gaps in projecting Swagger documents from OData services. I’d welcome a proposal at the GitHub repo for vocabularies: http://www.github.com/odata/vocabularies.
That might mean a generic client wouldn't known before hand what to expect for 2 different services unless it can see response headers, unless it states by its headers what format it wants to see?
Can there be a flag in $metadata stating the default format the service chose?
On the same lines, the default odata.metadata level is minimal.
Is there a way, a service can decide to override this and say in it's $metadata that by default "odata.metadata=none" in its responses?
Anil / Platform@CA
Typically we say that the default is up to the server. The server only needs to support one of the standardized serialization formats – but since JSON is the only format that is fully standardized at this point, we typically expect JSON to be the default response.
I can also say that I *hope* it’s not put down somewhere in the standard as the default. I personally believe we’re at the height of the maturity curve for JSON, and I think as HTTP debugging tools continue to rapidly improve, that we will see a shift in the default serialization format from JSON to a binary format, similar to what we’re seeing happen with HTTP2. So in my personal ideal future state, we would see something like Avro take over as the default serialization format for OData payloads – but of course that depends upon the ability of the server to choose the right default for the API.
I know that the default format for services in OData v4 changed to be JSON, but I am having difficulty in the spec finding where it explicitly states that. I would have expected to find something in the definition of the accept header and the $format query parameter. Something along the lines of if the accept header and $format query parameter are not present then the JSON format is used.