Skip to content
This repository was archived by the owner on Feb 12, 2022. It is now read-only.
This repository was archived by the owner on Feb 12, 2022. It is now read-only.

Type inheritance is broken for array types #552

Description

@stojsavljevic

Hi,

I have a problem getting type of object for item in response array.
Consider this raml:

#%RAML 1.0
title: Type inheritance is broken for array types

types:
    Foo:
        type: object
    Bar:
        type: Foo
        
        
/bar:
  get:
    responses:
      200:
        body:
          application/json:
            type: array
            items: Bar

and my test case:

RamlModelResult ramlModelResult = new RamlModelBuilder().buildApi(new File("api.raml"));
Api api = ramlModelResult.getApiV10();
for (Resource res : api.resources()) {
	for (Method method : res.methods()) {
		for (Response response : method.responses()) {
			for (TypeDeclaration type : response.body()) {
				ArrayTypeDeclaration array = (ArrayTypeDeclaration) type;
				TypeDeclaration items = array.items();
				System.out.println(items.type());
			}
		}
	}
}

will print out: Bar

But if I define response in raml like this:

application/json:
   type: Bar[]

test case will print out: Foo as expected.

Aha! Link: https://mulesoft-roadmap.aha.io/features/APIRAML-49

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions