RE: [odata] JSON CSDL: Representing property facets

From
Borges, Matt <>
Date
2014-12-12T17:52:05+00:00
ID
Thread
RE: [odata] JSON CSDL: Representing property facets
I agree with Hubert.  My impression is that instead of making an equivalent JSON representation of the CSDL, we are making something more complicated and harder to read so that we adhere to another spec.  And in some cases, I think we are losing some of
the OData information.  For example, in section 4.1.2.4 in the JSON CSDL document, there is an example of an Edm.Decimal property, Price.  Nowhere in the example JSON does it actually say that the OData type of the property is Edm.Decimal.  Yet if you were
to access that property directly (i.e. ~/Entity(key)/Price), the context URL in the payload would contain Edm.Decimal.

 

Another thing to consider is that in the current CSDL document we have the section about Metadata Service Schema.  The JSON payloads that are returned when accessing this service is quite different than the proposed JSON CSDL format based on JSON schema,
yet it is intended to represent the same information.  That seems like a huge inconsistency in our spec.

 

I think our highest priority has to be clearly and concisely describing the OData metadata of a service in a JSON document that is consistent with the rest of the OData spec.  As Hubert mentions, JSON schema does not appear to be a natural fit.

 

Matt

 

-----Original Message-----

From:  [mailto:] On Behalf Of Hubert Heijkers

Sent: Friday, December 12, 2014 6:00 AM

To: Handl, Ralf

Cc: 

Subject: Re: [odata] JSON CSDL: Representing property facets

 

Hi Ralf, et.al.,

 

It's been bothering me for a bit, and I don't think I can express very well

what exactly it is, but I more and more am getting the feeling, especially

when I see things like you are proposing, that we are creating something

pretty ugly just because we are trying to adhere to something that is not

likely the best natural fit for what we are trying to convey, which, after

all, is the schema of our service.

 

Now don't get me wrong, I do see value in having a JSON schema, but for

those cases were we'd want to validate our payloads, for which we need less

then what we are trying to put in currently. As you say, there are clients

that are not interested in validating payloads, and I wonder, aren't we

making it to hard on them because we are trying to make the JSON CSDL a

JSON Schema too?

 

So here is a crazy idea, why wouldn't we have a nice clean JSON CSDL and,

separately, allow services to provide a JSON Schema as well put purely for

validation, meaning that it wouldn't have to convey any of the OData

specifics?

 

Any thoughts anybody? Tell me if you think I'm nuts too, wouldn't be the

first time, I can take it;-).

 

Happy holidays,

 

-H

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

                     Hubert Heijkers                                                    

                     STSM, Chief Architect TM1 Server                                   

                     Business Analytics                                                 

 

                     Phone: +31-20-513-9456                                             

                     Mobile: +31-621-394123                                             

                     E-mail:                                  

 

 

                                                                        (Embedded image 

                                                                        moved to file:  

                                                                        pic10387.gif)   

 

 

 

 

 

 

 

 

 

                     (Embedded image moved to file: pic53554.gif)Facebook Button        

                        (Embedded image moved to file: pic10481.gif)LinkedIn Button     

                            OData Button                                                

                               OASIS Button                                             

 

 

 

    (Embedded image moved to file: pic46286.jpg)                                        

 

 

 

 

 

 

                                                               (Embedded image moved to 

                                                               file: pic56306.jpg)      

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

From:   "Handl, Ralf" <>

To:     "" <>

Date:   11/28/2014 11:29 AM

Subject:        [odata] JSON CSDL: Representing property facets

Sent by:        <>

 

 

 

I’ve received feedback that the current translation of primitive type

facets into JSON Schema makes the JSON CSDL hard to understand for clients

that are not interested in validating payloads but just want to get the

OData metadata.

 

For example a simple

 

<Property Type="Edm.Decimal" Name="Price" Precision="15" Scale="3" />

 

Becomes (as Nullable="true" is the default):

 

"anyOf":[{"type":"number", "multipleOf":0.001, "minimum":-999999999999.999,

"maximum":999999999999.999}, {"type":"null"}]

 

 

One way to make this more digestible would be to redundantly add the OData

facets to the JSON Schema representation:

 

"anyOf":[{"type":"number", "multipleOf":0.001, "minimum":-999999999999.999,

"maximum":999999999999.999}, {"type":"null"}], "precision":15, "scale":3

 

And redundantly add "nullable":false so clients don’t have to check for the

anyOf" or "type":["number","null"] constructs.

 

What do you think?

 

Thanks in advance!

--Ralf

 

        In preparing for battle

        I have always found that plans are useless,

        but planning is indispensable.

        - Dwight D. Eisenhower