public SundrioGenerator(ClientOptInput opts) { this.opts = opts; this.swagger = opts.getSwagger(); }
public boolean isRelationPath() { return isParentChildPath() || isRelatedToManyPath(); }
private void generateSdkForSwaggerDef(String language, String swaggerDefLocation, String tempOutputDirectory) { CodegenConfigurator codegenConfigurator = new CodegenConfigurator(); codegenConfigurator.setInputSpec(swaggerDefLocation); codegenConfigurator.setOutputDir(tempOutputDirectory); codegenConfigurator.setLang(sdkGenLanguages.get(language)); final ClientOptInput clientOptInput = codegenConfigurator.toClientOptInput(); new DefaultGenerator().opts(clientOptInput).generate(); }
@Override public void run() { System.out.println(); CodegenConfig config = CodegenConfigLoader.forName(lang); System.out.println("CONFIG OPTIONS"); for (CliOption langCliOption : config.cliOptions()) { System.out.println("\t" + langCliOption.getOpt()); System.out.println("\t " + langCliOption.getOptionHelp().replaceAll("\n", "\n\t ")); System.out.println(); } } }
protected void addOption(String key, String description, String defaultValue) { CliOption option = new CliOption(key, description); if (defaultValue != null) option.defaultValue(defaultValue); cliOptions.add(option); }
protected void addSwitch(String key, String description, Boolean defaultValue) { CliOption option = CliOption.newBoolean(key, description); if (defaultValue != null) option.defaultValue(defaultValue.toString()); cliOptions.add(option); }
public synchronized static SwaggerContext create(ClientOptInput opts) { context = new SwaggerContext(opts.getSwagger(), opts.getConfig(), opts); return context; }
public JavaResteasyEapServerCodegen() { super(); useBeanValidation = true; artifactId = "swagger-jaxrs-resteasy-eap-server"; outputFolder = "generated-code/JavaJaxRS-Resteasy-eap"; dateLibrary = "legacy";// TODO: change to joda cliOptions.add(CliOption.newBoolean(USE_BEANVALIDATION, "Use BeanValidation API annotations")); cliOptions.add(CliOption.newBoolean(GENERATE_JBOSS_DEPLOYMENT_DESCRIPTOR, "Generate Jboss Deployment Descriptor")); cliOptions.add(CliOption.newBoolean(USE_SWAGGER_FEATURE, "Use dynamic Swagger generator")); }
@SuppressWarnings("static-method") protected CliOption buildLibraryCliOption(Map<String, String> supportedLibraries) { StringBuilder sb = new StringBuilder("library template (sub-template) to use:"); for (String lib : supportedLibraries.keySet()) { sb.append("\n").append(lib).append(" - ").append(supportedLibraries.get(lib)); } return new CliOption("library", sb.toString()); }
/** * Check if act as Restful index to retrieve many children method * * @return true if act as Restful index to many items method, false otherwise */ public boolean isRestfulIndexToMany() { return "GET".equals(httpMethod) && isRelatedToManyPath(); }
/** * Check if act as Restful child via parent create method * * @return true if act as Restful child via parent create method, false otherwise */ public boolean isRestfulRelatedCreate() { return "POST".equalsIgnoreCase(httpMethod) && isParentChildPath() ; }
@Override public Reader getTemplate(String name) { return generator.getTemplateReader(TEMPLATE_DIR_CLASSPATH + File.separator + name.concat(MUSTACHE_EXTENSION)); } };
/** * Check if act as Restful show method * * @return true if act as Restful show method, false otherwise */ @Override public boolean isRestfulShow() { return "GET".equals(httpMethod) && isByIdPath(); }
private void generateSdkForSwaggerDef(String language, String swaggerDefLocation, String tempOutputDirectory) { CodegenConfigurator codegenConfigurator = new CodegenConfigurator(); codegenConfigurator.setInputSpec(swaggerDefLocation); codegenConfigurator.setOutputDir(tempOutputDirectory); codegenConfigurator.setLang(sdkGenLanguages.get(language)); final ClientOptInput clientOptInput = codegenConfigurator.toClientOptInput(); new DefaultGenerator().opts(clientOptInput).generate(); }
/** * Check if act as Restful destroy method * * @return true if act as Restful destroy method, false otherwise */ public boolean isRestfulDestroy() { return "DELETE".equalsIgnoreCase(httpMethod) && !isRelatedToManyPath() && !isParentChildPath(); }
public JavaResteasyServerCodegen() { super(); artifactId = "swagger-jaxrs-resteasy-server"; outputFolder = "generated-code/JavaJaxRS-Resteasy"; dateLibrary = "legacy";// TODO: change to joda cliOptions.add(CliOption.newBoolean(GENERATE_JBOSS_DEPLOYMENT_DESCRIPTOR, "Generate Jboss Deployment Descriptor")); }
/** * Check if act as Restful many children via parent create method * * @return true if act as Restful many children via parent create method, false otherwise */ public boolean isRestfulRelatedToManyCreate() { return "POST".equalsIgnoreCase(httpMethod) && isRelatedToManyPath() ; }
/** * Check if act as Restful index to retrieve child via parent method * * @return true if act as Restful index to child via parent, false otherwise */ public boolean isRestfulIndexRelated() { return "GET".equals(httpMethod) && isParentChildPath() ; }
/** * Check if act as Restful destroy many children method * * @return true if act as Restful destroy many child items method, false otherwise */ public boolean isRestfulDestroyToMany() { return "DELETE".equalsIgnoreCase(httpMethod) && isRelatedToManyPath(); }
/** * Check if act as Restful child via parent destroy method * * @return true if act as Restful child via parent destroy method, false otherwise */ public boolean isRestfulRelatedDestroy() { return "DELETE".equalsIgnoreCase(httpMethod) && isParentChildPath(); }