Difference in resource level base uri parameters and root level base uri parameters
Root level base uri parameters return Map<String, UriParameter> Map<String, UriParameter> baseUriParams = raml.getBaseUriParameters();
Resource level base uri parameters return Map<String, List<UriParameter>> Map<String, List<UriParameter>> baseUriParams = resource.getBaseUriParameters();
Is this difference relates to multiple types for single key? What's the reason for this difference?
Aha! Link: https://mulesoft-roadmap.aha.io/features/APIRAML-134
Hi @ymohdriz: From the RAML 0.8 spec:
A resource or a method can override a base URI template's values. This is useful to restrict or change the default or parameter selection in the base URI. The baseUriParameters property MAY be used to override any or all parameters defined at the root level baseUriParameters property, as well as base URI parameters not specified at the root level.
And considering the following example:
#%RAML 0.8
title: Examle API
version: 1
baseUri: https://{domain}.example.com/{otherThing}
baseUriParameters:
domain:
enum: [ "api" ]
otherThing:
type: integer
/resource:
baseUriParameters:
domain:
enum: [ "api-domain" ]
/anotherResource:
If you use getBaseUriParameters() in the context of /resource, you are overriding the domain, defined in the root of the RAML. On the contrary, if you call getBaseUriParameters() in the context of /anotherResource you are neither overriding nor adding params.
So, the getBaseUriParameters() is currently returning the params "inside" the context where you call it, not in a globally way.
Did this answer your question? Please, let me know if you need more info.