Skip to content
This repository has been archived by the owner on Jan 21, 2024. It is now read-only.

Improve WebApiBaseUnit.getDeclarationByName

Compare
Choose a tag to compare
@postatum postatum released this 23 Jul 05:58
· 69 commits to master since this release

Reworked WebApiBaseUnit.getDeclarationByName to return all valid declarations of RAML 1.0 Data Types.

All of the changes come from PR #30

Breaking changes

This release presents potentially breaking changes for Java users. In particular WebApiBaseUnit.getDeclarationByName now returns an instance of amf.client.model.domain.AnyShape instead of amf.client.model.domain.NodeShape. Note that NodeShape is a subclass of AnyShape as API docs state.

Considering this, you might need to explicitly convert an instance of AnyShape returned by WebApiBaseUnit.getDeclarationByName to its subclasses to access subclass-specific properties.

E.g. to access UnionShape.anyOf property you would have to do:

UnionShape user = (UnionShape) model.getDeclarationByName("User");
System.out.println(user.anyOf());

JS users should face no breaking changes.