Skip to main content

Major Improvements Released for Better RAML Resource Types and Traits Support

· 2 min read

Resource types and traits are an integral part of RAML. We have been working hard in improving our support for them in order to improve your RAML conversion experience on API Transformer. Majority of the improvements target RAML v1.0 while some of them also target v0.8.

Details

Here are details of the improvements made:

  • [RAML v1.0] Merging of resource types and traits and applying them to resources and methods (respectively) now follow the algorithm described at this link. Due to this, you can expect improved support for nested resource types/traits as well as a more accurate output resulting from the merge because of careful consideration of precedence/priority of the components being merged.

  • [RAML v1.0] With RAML 1.0 came support for complex type resource type and trait param values in addition to string values. Details regarding this feature can be found in their spec here. We have improved support for such parameters.

  • [RAML v0.8] In RAML 0.8, resource type parameter values can be further transformed by applying functions like !singularize or !pluralize. More details regarding these can be found here. Support for these were missing in our RAML v0.8 parsers and have now have been added.

  • [RAML v0.8, v1.0] Previously, our parsing process involved a step where resource types and traits were validated before applying their parameters. This often caused issues especially in cases where resource type or trait params were expected to have a value of a type other than string e.g. in the example of the resource type below, a param <<minimumValue>> is assigned as a value for boolean property minimum.

resourceTypes:
collection:
get:
queryParameters:
per_page:
type: integer
minimum: <<minimumValue>>

Because of processing this resource type before applying the parameters, our parser assumed that the user incorrectly assigned a string value <<minimumValue>> to a boolean property and threw an exception. We have now restructured our parsers so that resource types and traits are now evaluated only after the parameters have been applied to avoid such issues.

  • [RAML v1.0] Other minor improvements to support RAML v1.0 library-level resource types and traits in a better way were also made.

Transform new or re-import your existing RAML files to get the latest changes. If you notice any issues or have any feedback, you can always generate a support ticket on our website.