Object unique keys


#1

Hello,

I was looking at some RAML APIs examples for version (1.0 http://docs.raml.org/apis/media-wiki/) and I noticed that the the first resource (/) declares 4 methods with the same key get.

If I am understanding RAML 1.0 specification correctly, this shouldn’t be allowed.

From http://docs.raml.org/specs/1.0/#markup-language

Property names, also known as Keys, at given levels are not repeatable. Although YAML allows such repetition duplicate-keys will overwriting previously specified values.

So the question is, is this valid? Is there any way to define multiple get methods inside the same resource? Does this limitation applies to other sections such as query parameters or headers?

Cheers!


#2

Good question, I would assume duplicate method definitions on the same resource are invalid.
+1 for an official reply on this one


#3

Hi, so the official answer is no and the example is wrong. Thanks for raising it. RAML is based on YAML, and therefore its forbidden to have repeatable keys in any map node. Hope that answers your question.


#4

Raised that as an issue here https://github.com/raml-apis/MediaWiki/issues/1. Please let me know if you find more of these.


#5

Thank you @christian_vogel. I’ll comment on the issue.