restfulobjects / restfulobjects-spec

The Restful Objects specification defines a set of RESTful resources, and corresponding JSON representations, for accessing and manipulating a domain object model.
http://restfulobjects.org
73 stars 10 forks source link

Handling of enums #5

Open danhaywood opened 11 years ago

danhaywood commented 11 years ago

ver: 1.0.0 raisedby: stefcascarini

ref: http://restfulobjects.codeplex.com/workitem/30

Two solutions (within the current spec) come to mind

  1. the value in all ways is presented and set as a string.
  2. Present the value as the correct underlying integral type with the choices as the set of possible integral underlying values.

I'm not keen on 1.

However 2. for the moment means that enums don't really add any value (just the set of possible values).

I would propose to do 2. now but ask for some explicit support in the next version of the spec.

eg how about something in the extensions (and formal types) which contains 'display hints' and a map (eg {{"Male : 0}, {"Female" : 1}}) which would allow a client to display the value and choices in a friendly way but send and receive the underlying type.