Open econchick opened 7 years ago
I don't think that this is true. The spec states
To accommodate this need, a resource type definition MAY append a question mark ("?") suffix to the name of any method to declare the method as optional, resulting in the following behavior:
@sichvoge Under the General headline, it says:
A trailing question mark, for example description?, indicates an optional property.
There's also many examples of non-methods having trailing question marks. For instance, in the table listing nodes for the Root of a RAML file.
OH, maybe it's a bit confusing first; but that general headline only talks about optional nodes in RAML. That means, when we say
A trailing question mark, for example description?, indicates an optional property.
It really mean, whenever you see (inside the specification document) a node with a question mark; it is an optional node. For example:
#%RAML 1.0
title: A
description: Test
#%RAML 1.0
title: A
Both examples are valid, since description
is an optional node. On the other hand, title
is a required node and leaving it out is not valid.
When you said "In RAML 0.8, only methods w/i resource types were optional, denoted with a question mark (e.g. get?).", you referred to a mechanism that is available in a resource type definition. Marking a method "optional" does nothing else than having you to declare it explicitly on the resource to apply it. For example:
#%RAML 1.0
title: A
resourceTypes:
collection:
get:
post?:
/resource:
type: collection
/resource1:
type: collection
post:
In that case, /resource
has only one HTTP method get
, but resource1
has post
and get
.
In RAML 0.8, only methods w/i resource types were optional, denoted with a question mark (e.g.
get?
.In RAML 1.0, a lot more can be optional. We should figure out a sane approach to parsing and reflecting how a named attribute is optional.