Complex defaults - are they valid?

When reading the specification, I get the impression that the “default” facet is valid for any type.
However, in practice when I try to render it to html using raml2html, such defaults are lost. I also checked the output of raml2obj, and already there they are not present, so it is not just a nunjucks template problem. Should this work? Is this according to spec?

Here is an example to show that I mean (see the default: entries):

#%RAML 1.0
title: example
description: Example as a Service
version: v1
protocols: [HTTP]
baseUri: http://example.com
mediaType: application/json

types:
  my-obj:
    type: object
    properties:
      list-of-strings:
        type: array
        items: string
        default: ["element 1", "element 2"]
      sub-object:
        type: object
        properties:
          prop-1: string
          prop-2: integer
        default:
          prop-1: "how to write a default?"
          prop-2: 42



/api/example/v1:
  get:
    responses:
      200:
        body:
          application/json:
            type: my-obj

I don’t see any issue with your RAML. It’s valid. This seems like a bug with the tools you are using.

1 Like

Thanks!
Also crap, that was what i was afraid of…

Do you have any suggestions of alternative tools for rendering human-friendly documentation, and that would be likely to support this? Anything built atop webapi-parser perhaps? I looked, but wouldn’t be surprised if i missed what to search for.

Have you looked at any of the projects listed under “Document” here: https://raml.org/projects? (btw, I think this list is not up-to-date, I put a note to update this week)

Yes, although admittedly not for this issue. There were some things i didn’t remember seeing the last time around, like the workbook. I’ll revisit the API console, as my experience with that is going on 3 years old.
(And apart from that i can’t see that any of the other yields more or less staright-up html docs)