use of org.raml.v2.api.model.v10.datamodel.ObjectTypeDeclaration in project raml-for-jax-rs by mulesoft-labs.
the class TypeUtilsTest method shouldExtendingAnotherMultipleInheritance.
@Test
public void shouldExtendingAnotherMultipleInheritance() throws Exception {
Map<String, GType> finder = finder("extendObjectMultipleIneritance.raml");
ObjectTypeDeclaration object = (ObjectTypeDeclaration) finder.get("ObjectOne").implementation();
TypeDeclaration extending = findProperty(object, "name");
ObjectTypeDeclaration extended = (ObjectTypeDeclaration) finder.get(extending.type());
assertTrue(TypeUtils.shouldCreateNewClass(extending, extended));
}
use of org.raml.v2.api.model.v10.datamodel.ObjectTypeDeclaration in project raml-for-jax-rs by mulesoft-labs.
the class TypeUtilsTest method shouldExtendingAnother.
@Test
public void shouldExtendingAnother() throws Exception {
Map<String, GType> finder = finder("extendingAnother.raml");
ObjectTypeDeclaration object = (ObjectTypeDeclaration) finder.get("ObjectOne").implementation();
TypeDeclaration extending = findProperty(object, "name");
ObjectTypeDeclaration extended = (ObjectTypeDeclaration) finder.get(extending.type()).implementation();
assertFalse(TypeUtils.shouldCreateNewClass(extending, extended));
}
use of org.raml.v2.api.model.v10.datamodel.ObjectTypeDeclaration in project raml-for-jax-rs by mulesoft-labs.
the class JustLoadTest method justLoad.
@Test
public void justLoad() throws URISyntaxException {
/*
* RamlModelResult ramlModelResult = new RamlModelBuilder().buildApi(new
* File(JustLoadTest.class.getResource("/jaxrs-test-resources.raml").toURI()));
*/
RamlModelResult ramlModelResult = new RamlModelBuilder().buildApi(new File("target/generated-sources/raml-jaxrs/jaxrs-test-resources.raml"));
if (ramlModelResult.hasErrors()) {
for (ValidationResult validationResult : ramlModelResult.getValidationResults()) {
System.out.println(validationResult.getMessage());
}
fail("Cant load");
}
Api api = ramlModelResult.getApiV10();
/*
* Api api = ramlModelResult.getApiV10(); ObjectTypeDeclaration otd = (ObjectTypeDeclaration) api.types().get(0);
* ArrayTypeDeclaration atd = (ArrayTypeDeclaration) otd.properties().get(0); ObjectTypeDeclaration arrayItems =
* (ObjectTypeDeclaration) atd.items(); System.err.println(arrayItems.type());
*/
}
use of org.raml.v2.api.model.v10.datamodel.ObjectTypeDeclaration in project raml-for-jax-rs by mulesoft-labs.
the class TypeUtilsTest method bigRaml.
@Test
public void bigRaml() throws Exception {
Map<String, GType> finder = finder("big.raml");
ObjectTypeDeclaration object = (ObjectTypeDeclaration) finder.get("RamlDataType").implementation();
TypeDeclaration extending = findProperty(object, "NilValue");
ObjectTypeDeclaration extended = (ObjectTypeDeclaration) finder.get(extending.type());
assertTrue(TypeUtils.shouldCreateNewClass(extending, extended));
}
use of org.raml.v2.api.model.v10.datamodel.ObjectTypeDeclaration in project raml-for-jax-rs by mulesoft-labs.
the class TypeUtilsTest method shouldExtendingObjectWithProperties.
@Test
public void shouldExtendingObjectWithProperties() throws Exception {
ObjectTypeDeclaration typeDeclaration = (ObjectTypeDeclaration) finder("extendObjectWithProperties.raml").get("ObjectOne").implementation();
TypeDeclaration property = findProperty(typeDeclaration, "name");
assertTrue(TypeUtils.shouldCreateNewClass(property, null));
}
Aggregations