在 RAML 中定义特征时,可以对其进行参数化,例如
traits:
- searchable:
queryParameters:
query:
description: Blah blah
example: <<example>>
有一个 <<example>>
由具有此特征的资源提供的参数,如下所示:
is: [searchable: {example: "exampleValue"}]
是否可以为特征参数指定默认值,以便具有默认值的资源可以省略该参数?
最佳答案
只需添加默认 key 即可执行您需要的操作:
traits:
- searchable:
queryParameters:
query:
description: Blah blah
example: <<example>>
default: "default value"
关于RAML 特征参数默认值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32975461/