Java parser and Libraries


Hi there.
i have a question about using libraries with the java parser.

In my main RAML file i have added some libraries for defining types and annotations.

  myTypes: types.raml
  annotation: annotations.raml

in the types.raml the first lines are:

#%RAML 1.0 Library

If i parse the api.raml with the java parser (even with the 1.0.1-SNAPSHOT) i get no errors. But if i want to get a list of all types i get an empty list.

List<TypeDeclaration> types = apiV10.types();

Did i something wrong? Can anyone help?


Maybe raise the issue on the java-parser repo on Github. There you have a high chance to get some help from the development team directly :wink:


The uses in the API file is what you are looking for:

Api api = ramlModelResult.getApiV10();
api.uses().forEach(l -> {

   void handleTypes(List<TypeDeclaration> types) {
    types.forEach(t -> {
      ... do something here with it...


Thanks, that helps a lot.