Proposal: alternative date type in RAML


#1

Disclaimer: While I have been working with RAML for almost a year now, and am familiar with the 0.8 spec, I’m new to this forum category. Also, I have not been involved in the ongoing efforts of defining RAML 1.0 yet. Please treat my incompetence with kindness.

As far as I can see, the date type in RAML 0.8 is derived from the one used in the HTTP protocol. Of course, that is very useful when defining header parameters in RAML. But it may not be the best available date format for other data-processing scenarios. In particular, it is slightly redundant, contains cultural baggage, needs to be fully parsed for comparisons or sorting. Also, it would lead to additional URL encoding when used in uri-parameters or query-parameters, due to the spaces.

On the other hand, both schema languages in use with RAML employ more sane date formats:

  • XML Schema makes use of ISO 8601
    (and also defines some neat formats for durations)
  • JSON-Schema makes use of RFC 3339

… which for most practical purposes are equal, as far as I know.

I’d like to suggest to introduce an additional date type to RAML, that would be more consistent with the schema languages. It would also lack most of the shortcomings that I mentioned above. How about calling it isodate? While at it, you might also consider adding some of the duration types from XML schema?


#2

Yes. This. Please.


#3

Just started looking at 1.0 and this still appears to be sorely lacking from the new types capability. We use XML dateTime/ISO-8601 style timestamps pervasively and I’d love a default way to indicate that without resorting to nasty regexes.


#4

This is a perfect example of something that could be codified as a library of types, which would avoid binding the specifications together when it’s not otherwise necessary.


#5

Did not test any 1.0 stuff yet, but from the documentation it appears that external types might help to solve this problem. Not sure whether that works for scalar types though. If anyone knows what an XML-Schema or JSON-Schema should look like in order to declare just the respective date-type for inclusion into RAML 1.0, please post it here! :smile:


#6

Yes, in RAML 1.0 the date type is still derived from RFC2616. If there is a need for others, please raise that on the raml-spec github account and we can discuss that in more details.

In the meanwhile, could you define other date types with the new type system + define a pattern for it?


#7

Can everyone please comment on that issue https://github.com/raml-org/raml-spec/issues/202 so that we can make a decision to change the current format to RFC3339.