raml-java-parser
raml-java-parser copied to clipboard
URI parameters are not inherited for nested resources
Hi all!
I'm using the raml-parser-2 v. 1.0.7 to parse the following RAML:
#%RAML 1.0
---
title: Library API
baseUri: http://localhost/library
/authors:
/{authorId}:
uriParameters:
authorId:
type: integer
description: The ID of the author.
/books:
/{bookId}:
uriParameters:
bookId:
type: string
description: The ID of the book.
get:
displayName: Get a book by its ID.
responses:
200:
body:
application/json:
example: '{ "book": "The Hitchhikers Guide to the Galaxy" }'
For the method with resource path /authors/{authorId}/books/{bookId}
I'm getting that it only has one URI parameter (with display name "bookId").
I think that the expected behavior would be to get the "inherited" authorId parameter as well. I wasn't able to find any piece of information in the spec regarding the behavior of the parsers in this situation.
Thanks for your help!
Aha! Link: https://mulesoft-roadmap.aha.io/features/APIRAML-99
I am not aware of any built-in method to return all inherited URI parameters. In my case, I had to write my own code to recursively collect URI parameters from parent resources.