raml-org / raml-spec

RAML Specification
http://raml.org
3.87k stars 858 forks source link

Resource parameter default values #760

Open rspremulli-sf opened 3 years ago

rspremulli-sf commented 3 years ago

Would like to be able to define a default value for a resource parameter so that if it is not passed, it will be defaulted. Use case: a trait that has a standard min/max/default value, but that can be overridden if necessary. For example, a trait that adds query parameters to a list api. this would have query parameters for offset and limit. Limit would have a default value for the number of returned records, and a maximum number allowed. I would like to define this in the trait. Then, if I have an endpoint that needs to change those numbers (for example, raise it because there is a larger amount of smaller data) I can override the default

Current workaround: Create two traits: One with resource parameters, and one without that calls the first one and passes in values. This requires duplicated traits to exist and be maintained though