diff --git a/pom.xml b/pom.xml index 3ceaddf..758423e 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.amartus.y2s yang2swagger-tapi-cli - 1.3.1 + 1.4 1.1.10 diff --git a/src/main/java/com/amartus/y2s/Generator.java b/src/main/java/com/amartus/y2s/Generator.java index e622260..2217dbb 100644 --- a/src/main/java/com/amartus/y2s/Generator.java +++ b/src/main/java/com/amartus/y2s/Generator.java @@ -73,6 +73,9 @@ public class Generator { @Option(name = "-fullCrud", usage="If the flag is set to false path are generated for GET operations only. Default true") public boolean fullCrud = true; + @Option(name = "-generate-for-global-class", usage="Generate resource URL only for GlobalClass nodels. Default false") + public boolean forGlobalClass = false; + OutputStream out = System.out; public enum AuthenticationMechanism { @@ -129,9 +132,15 @@ protected void generate() throws IOException, ReactorException { .version(apiVersion) .format(outputFormat).consumes(contentType).produces(contentType) .host("localhost:1234").elements(map(elementType)) - .pathHandler(pathHandler) - .appendPostProcessor(new PathPrunner("/operations").withType("tapi.common.GlobalClass")) - .appendPostProcessor(new CollapseTypes()); + .pathHandler(pathHandler); + + + if(forGlobalClass) { + generator + .appendPostProcessor(new PathPrunner("/operations").withType("tapi.common.GlobalClass")); + } + generator + .appendPostProcessor(new CollapseTypes()); if(AuthenticationMechanism.BASIC.equals(authenticationMechanism)) { generator.appendPostProcessor(new AddSecurityDefinitions().withSecurityDefinition("api_sec", new BasicAuthDefinition()));