raml-java-parser
raml-java-parser copied to clipboard
Resource.getResolvedUriParameters() does not return all inherited URI parameters and they are in unexpected order
This method has two bugs.
Issue 1: It returns URI parameters for the current resources and only the immediately parent. This is contrary to the javadoc which says "all URI parameters defined in the resource hierarchy".
Issue 2: It returns the result in an unordered Map (HashMap). Instead, it should return the URI parameters in order (LinkedHashMap). This way, when iterating over the entries in the map, I get the parameters in order as they appear in the resource path.
Aha! Link: https://mulesoft-roadmap.aha.io/features/APIRAML-146
For example, take the below RAML. getResolvedUriParameters() won't return me all the parameters for "/artists/{artistId}/songs/{songId}". It would only return "songId" but not "artistId". I suspect the method was intended to recursively collect parameters from parent resources, but it isn't actually doing any recursion.
#%RAML 0.8
title: Simple path test
version: v3
baseUri: http://fakehost/some/base/path
/artists:
post:
responses:
200:
description: OK
/{artistId}:
uriParameters:
artistId:
type: integer
get:
responses:
200:
description: OK
/songs:
/{songId}:
uriParameters:
songId:
type: integer
get:
responses:
200:
description: OK
Resource.getResolvedUriParameters() does not exist in raml-parser-2. So, this may no longer be applicable.
However, Resource.getUriParameters() no longer returns parameterized path segments that are not explicitly defined which used to work in the original raml-parser. See https://github.com/raml-org/raml-java-parser/issues/201