use of org.raml.v2.api.RamlModelBuilder in project raml-module-builder by folio-org.
the class JsonSchemaPojoUtil method getSchemasFromRaml.
public static List<GlobalSchema> getSchemasFromRaml(File path2Raml) {
RamlModelResult ramlModelResult = new RamlModelBuilder().buildApi(path2Raml.getAbsolutePath());
// get a list of schemas from the raml
List<GlobalSchema> schemaListInRAML = ramlModelResult.getApiV08().schemas();
return schemaListInRAML;
}
use of org.raml.v2.api.RamlModelBuilder 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.RamlModelBuilder in project raml-for-jax-rs by mulesoft-labs.
the class TypeUtilsTest method finder.
private Map<String, GType> finder(String raml) {
RamlModelResult ramlModelResult = new RamlModelBuilder().buildApi(new InputStreamReader(this.getClass().getResourceAsStream(raml)), ".");
if (ramlModelResult.hasErrors()) {
for (ValidationResult validationResult : ramlModelResult.getValidationResults()) {
System.out.println(validationResult.getMessage());
}
throw new AssertionError();
} else {
final Map<String, GType> decls = new HashMap<>();
new V10Finder(null, ramlModelResult.getApiV10()).findTypes(new GFinderListener() {
@Override
public void newTypeDeclaration(GType type) {
decls.put(type.name(), type);
}
});
return decls;
}
}
Aggregations