org.raml.model.Raml Java Examples
The following examples show how to use
org.raml.model.Raml.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RamlCompilerMojo.java From wisdom with Apache License 2.0 | 6 votes |
/** * Generate the raml file from a given controller source file. * * @param source The controller source file. * @param model The controller model * @throws WatchingException If there is a problem while creating the raml file. */ @Override public void controllerParsed(File source, ControllerModel<Raml> model) throws WatchingException { Raml raml = new Raml(); //Create a new raml file raml.setBaseUri(baseUri); //set the base uri raml.setVersion(project().getVersion()); //Visit the controller model to populate the raml model model.accept(controllerVisitor, raml); getLog().info("Create raml file for controller " + raml.getTitle()); try { //create the file File output = getRamlOutputFile(source); FileUtils.write(output, ramlEmitter.dump(raml)); getLog().info("Created the RAML description for " + source.getName() + " => " + output.getAbsolutePath()); } catch (IOException ie) { throw new WatchingException("Cannot create raml file", source, ie); } catch (IllegalArgumentException e) { throw new WatchingException("Cannot create Controller Element from", e); } }
Example #2
Source File: ApiGatewaySdkRamlApiImporter.java From aws-apigateway-importer with Apache License 2.0 | 6 votes |
@Override public String createApi(Raml raml, String name, JSONObject config) { this.config = config; // TODO: What to use as description? final RestApi api = createApi(getApiName(raml, name), null); LOG.info("Created API "+api.getId()); try { final Resource rootResource = getRootResource(api).get(); deleteDefaultModels(api); createModels(api, raml.getSchemas(), false); createResources(api, createResourcePath(api, rootResource, raml.getBasePath()), new HashMap<String, UriParameter>(), raml.getResources(), false); } catch (Throwable t) { LOG.error("Error creating API, rolling back", t); rollback(api); throw t; } return api.getId(); }
Example #3
Source File: RamlLoaders.java From raml-tester with Apache License 2.0 | 5 votes |
public RamlDefinition load(String name) { final Loader decorated = new UriLoader(loader); final Raml raml = caching ? new RamlCache(decorated).loadRaml(name) : new RelativeJsonSchemaAwareRamlDocumentBuilder(decorated, new LoaderRamlResourceLoader(decorated)).build(name); final SchemaValidators validators = schemaValidators.withloader(decorated); return new RamlDefinition(raml, validators); }
Example #4
Source File: CheckerConfig.java From raml-tester with Apache License 2.0 | 5 votes |
public CheckerConfig(Raml raml, List<SchemaValidator> schemaValidators, String baseUri, boolean includeServletPath, boolean ignoreXheaders, boolean failFast) { this.raml = raml; this.schemaValidators = schemaValidators; this.baseUri = baseUri; this.includeServletPath = includeServletPath; this.ignoreXheaders = ignoreXheaders; this.failFast = failFast; }
Example #5
Source File: ApiGatewaySdkRamlApiImporter.java From aws-apigateway-importer with Apache License 2.0 | 5 votes |
@Override public void updateApi(String apiId, Raml raml, JSONObject config) { this.config = config; RestApi api = getApi(apiId); Optional<Resource> rootResource = getRootResource(api); createModels(api, raml.getSchemas(), true); createResources(api, createResourcePath(api, rootResource.get(), raml.getBasePath()), new HashMap<String, UriParameter>(), raml.getResources(), true); cleanupResources(api, this.paths); cleanupModels(api, this.models); }
Example #6
Source File: ApiGatewayRamlFileImporter.java From aws-apigateway-importer with Apache License 2.0 | 5 votes |
@Override public void updateApi(String apiId, String filePath, JSONObject config) { LOG.info(format("Attempting to update API from RAML definition. " + "API identifier: %s RAML file: %s", apiId, filePath)); final Raml raml = parse(filePath); client.updateApi(apiId, raml, config); }
Example #7
Source File: ApiGatewayRamlFileImporter.java From aws-apigateway-importer with Apache License 2.0 | 5 votes |
@Override public String importApi(String filePath, JSONObject config) { LOG.info(format("Attempting to create API from RAML definition. " + "RAML file: %s", filePath)); final Raml raml = parse(filePath); return client.createApi(raml, new File(filePath).getName(), config); }
Example #8
Source File: ApiGatewaySdkRamlApiImporter.java From aws-apigateway-importer with Apache License 2.0 | 4 votes |
private String getApiName (Raml raml, String fileName) { String title = raml.getTitle(); return StringUtils.isNotBlank(title) ? title : fileName; }
Example #9
Source File: RamlDefinition.java From raml-tester with Apache License 2.0 | 4 votes |
public RamlDefinition(Raml raml, SchemaValidators schemaValidators) { this(new CheckerConfig(raml, schemaValidators.getValidators())); }
Example #10
Source File: RamlDefinition.java From raml-tester with Apache License 2.0 | 4 votes |
public Raml getRaml() { return config.raml; }
Example #11
Source File: SimpleReportAggregator.java From raml-tester with Apache License 2.0 | 4 votes |
protected Raml getRaml() { return raml; }
Example #12
Source File: CheckerConfig.java From raml-tester with Apache License 2.0 | 4 votes |
public CheckerConfig(Raml raml, List<SchemaValidator> schemaValidators) { this(raml, schemaValidators, null, false, false, false); }
Example #13
Source File: RamlReport.java From raml-tester with Apache License 2.0 | 4 votes |
public RamlReport(Raml raml) { this.raml = raml; }
Example #14
Source File: RamlReport.java From raml-tester with Apache License 2.0 | 4 votes |
public Raml getRaml() { return raml; }
Example #15
Source File: ApiGatewayRamlFileImporter.java From aws-apigateway-importer with Apache License 2.0 | 3 votes |
private Raml parse(String filePath) { final Raml raml = builder.build(filePath); // TODO: Error handling. return raml; }
Example #16
Source File: RamlApiImporter.java From aws-apigateway-importer with Apache License 2.0 | votes |
String createApi(Raml raml, String name, JSONObject config);
Example #17
Source File: RamlApiImporter.java From aws-apigateway-importer with Apache License 2.0 | votes |
void updateApi(String apiId, Raml raml, JSONObject config);