raml-spec icon indicating copy to clipboard operation
raml-spec copied to clipboard

Resource parameter default values

Open rspremulli-sf opened this issue 4 years ago • 0 comments

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

rspremulli-sf avatar Jul 03 '21 20:07 rspremulli-sf