test_class.declarator: RES_DIR = OpenAPICommandTest.getResourceFolderPath()
test_class.modifier: private static final
test_class.original_string: private static final Path RES_DIR = OpenAPICommandTest.getResourceFolderPath();
test_class.type: Path
test_class.var_name: RES_DIR
test_class.declarator: resourcePath = Paths.get(System.getProperty(USER_DIR))
test_class.original_string: Path resourcePath = Paths.get(System.getProperty(USER_DIR));
test_class.type: Path
test_class.var_name: resourcePath
test_class.declarator: petProject
test_class.modifier: private
test_class.original_string: private OpenAPIBallerinaProject petProject;
test_class.type: OpenAPIBallerinaProject
test_class.var_name: petProject
test_class.file: misc/openapi-ballerina/modules/openapi-to-ballerina-generator/src/test/java/org/ballerinalang/openapi/cmd/OpenAPICmdTest.java
test_class.identifier: OpenAPICmdTest
test_class.superclass: extends OpenAPICommandTest
test_case.body: @Test(description = "Test openapi command with --input flag", enabled = false)
      public void testOpenAPICmdInput() throws IOException {
          Path petstoreYaml = RES_DIR.resolve(Paths.get("petstore.yaml"));
          String[] args = {"--input", petstoreYaml.toString()};
          OpenApiCmd openApiCommand = new OpenApiCmd(printStream);
          new CommandLine(openApiCommand).parseArgs(args);
          openApiCommand.execute();
  
          String output = readOutput(true);
          Assert.assertTrue(output.contains("Following files were created."));
      }
test_case.class_method_signature: OpenAPICmdTest.testOpenAPICmdInput()
test_case.full_signature: @Test(description = "Test openapi command with --input flag", enabled = false) public void testOpenAPICmdInput()
test_case.identifier: testOpenAPICmdInput
test_case.invocations: resolve get toString parseArgs execute readOutput assertTrue contains
test_case.modifiers: @Test(description = "Test openapi command with --input flag", enabled = false) public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testOpenAPICmdInput()
focal_class.declarator: CMD_NAME = "openapi"
focal_class.modifier: private static final
focal_class.original_string: private static final String CMD_NAME = "openapi";
focal_class.type: String
focal_class.var_name: CMD_NAME
focal_class.declarator: outStream
focal_class.modifier: private
focal_class.original_string: private PrintStream outStream;
focal_class.type: PrintStream
focal_class.var_name: outStream
focal_class.declarator: executionPath = Paths.get(System.getProperty(USER_DIR))
focal_class.modifier: private
focal_class.original_string: private Path executionPath = Paths.get(System.getProperty(USER_DIR));
focal_class.type: Path
focal_class.var_name: executionPath
focal_class.declarator: targetOutputPath
focal_class.modifier: private
focal_class.original_string: private Path targetOutputPath;
focal_class.type: Path
focal_class.var_name: targetOutputPath
focal_class.declarator: helpFlag
focal_class.modifier: @CommandLine.Option(names = {"-h", "--help"}, hidden = true)
      private
focal_class.original_string: @CommandLine.Option(names = {"-h", "--help"}, hidden = true)
      private boolean helpFlag;
focal_class.type: boolean
focal_class.var_name: helpFlag
focal_class.declarator: inputPath
focal_class.modifier: @CommandLine.Option(names = {"-i", "--input"}, description = "Generating the client and service both files")
      private
focal_class.original_string: @CommandLine.Option(names = {"-i", "--input"}, description = "Generating the client and service both files")
      private boolean inputPath;
focal_class.type: boolean
focal_class.var_name: inputPath
focal_class.declarator: outputPath
focal_class.modifier: @CommandLine.Option(names = {"-o", "--output"}, description = "Location of the generated Ballerina service, " +
              "client and model files.")
      private
focal_class.original_string: @CommandLine.Option(names = {"-o", "--output"}, description = "Location of the generated Ballerina service, " +
              "client and model files.")
      private String outputPath;
focal_class.type: String
focal_class.var_name: outputPath
focal_class.declarator: mode
focal_class.modifier: @CommandLine.Option(names = {"--mode"}, description = "Generate only service file or client file according to the" +
              " given mode type")
      private
focal_class.original_string: @CommandLine.Option(names = {"--mode"}, description = "Generate only service file or client file according to the" +
              " given mode type")
      private String mode;
focal_class.type: String
focal_class.var_name: mode
focal_class.declarator: service
focal_class.modifier: @CommandLine.Option(names = {"-s", "--service"}, description = "Service name that need to documented as openapi " +
              "contract")
      private
focal_class.original_string: @CommandLine.Option(names = {"-s", "--service"}, description = "Service name that need to documented as openapi " +
              "contract")
      private String service;
focal_class.type: String
focal_class.var_name: service
focal_class.declarator: module
focal_class.modifier: @CommandLine.Option(names = {"-m", "--module"}, description = "Module name which service used to documented")
      private
focal_class.original_string: @CommandLine.Option(names = {"-m", "--module"}, description = "Module name which service used to documented")
      private  String module;
focal_class.type: String
focal_class.var_name: module
focal_class.declarator: tags
focal_class.modifier: @CommandLine.Option(names = {"--tags"}, description = "Tag that need to write service")
      private
focal_class.original_string: @CommandLine.Option(names = {"--tags"}, description = "Tag that need to write service")
      private String tags;
focal_class.type: String
focal_class.var_name: tags
focal_class.declarator: operations
focal_class.modifier: @CommandLine.Option(names = {"--operations"}, description = "Operations that need to write service")
      private
focal_class.original_string: @CommandLine.Option(names = {"--operations"}, description = "Operations that need to write service")
      private String operations;
focal_class.type: String
focal_class.var_name: operations
focal_class.declarator: generatedServiceName
focal_class.modifier: @CommandLine.Option(names = {"--service-name"}, description = "Service name for generated files")
      private
focal_class.original_string: @CommandLine.Option(names = {"--service-name"}, description = "Service name for generated files")
      private String generatedServiceName;
focal_class.type: String
focal_class.var_name: generatedServiceName
focal_class.declarator: argList
focal_class.modifier: @CommandLine.Parameters
      private
focal_class.original_string: @CommandLine.Parameters
      private List<String> argList;
focal_class.type: List<String>
focal_class.var_name: argList
focal_class.file: misc/openapi-ballerina/modules/openapi-to-ballerina-generator/src/main/java/org/ballerinalang/openapi/cmd/OpenApiCmd.java
focal_class.identifier: OpenApiCmd
focal_class.interfaces: implements BLauncherCmd
focal_class.class_method_signature: OpenApiCmd.OpenApiCmd()
focal_class.full_signature: public  OpenApiCmd()
focal_class.identifier: OpenApiCmd
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.signature:  OpenApiCmd()
focal_class.class_method_signature: OpenApiCmd.OpenApiCmd(PrintStream outStream)
focal_class.full_signature: public  OpenApiCmd(PrintStream outStream)
focal_class.identifier: OpenApiCmd
focal_class.modifiers: public
focal_class.parameters: (PrintStream outStream)
focal_class.signature:  OpenApiCmd(PrintStream outStream)
focal_class.class_method_signature: OpenApiCmd.execute()
focal_class.full_signature: @Override public void execute()
focal_class.identifier: execute
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void execute()
focal_class.class_method_signature: OpenApiCmd.ballerinaToOpenApi(String fileName)
focal_class.full_signature: private void ballerinaToOpenApi(String fileName)
focal_class.identifier: ballerinaToOpenApi
focal_class.modifiers: private
focal_class.parameters: (String fileName)
focal_class.return: void
focal_class.signature: void ballerinaToOpenApi(String fileName)
focal_class.class_method_signature: OpenApiCmd.openApiToBallerina(String fileName, Filter filter)
focal_class.full_signature: private void openApiToBallerina(String fileName, Filter filter)
focal_class.identifier: openApiToBallerina
focal_class.modifiers: private
focal_class.parameters: (String fileName, Filter filter)
focal_class.return: void
focal_class.signature: void openApiToBallerina(String fileName, Filter filter)
focal_class.class_method_signature: OpenApiCmd.getResourcePath(File resourceFile, String targetOutputPath)
focal_class.full_signature: private Path getResourcePath(File resourceFile, String targetOutputPath)
focal_class.identifier: getResourcePath
focal_class.modifiers: private
focal_class.parameters: (File resourceFile, String targetOutputPath)
focal_class.return: Path
focal_class.signature: Path getResourcePath(File resourceFile, String targetOutputPath)
focal_class.class_method_signature: OpenApiCmd.getTargetOutputPath()
focal_class.full_signature: private void getTargetOutputPath()
focal_class.identifier: getTargetOutputPath
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void getTargetOutputPath()
focal_class.class_method_signature: OpenApiCmd.generatesClientFile(CodeGenerator generator, String clientName, Path resourcePath, Filter filter)
focal_class.full_signature: private void generatesClientFile(CodeGenerator generator, String clientName, Path resourcePath, Filter filter)
focal_class.identifier: generatesClientFile
focal_class.modifiers: private
focal_class.parameters: (CodeGenerator generator, String clientName, Path resourcePath, Filter filter)
focal_class.return: void
focal_class.signature: void generatesClientFile(CodeGenerator generator, String clientName, Path resourcePath, Filter filter)
focal_class.class_method_signature: OpenApiCmd.generateServiceFile(CodeGenerator generator, String serviceName, Path resourcePath, Filter filter)
focal_class.full_signature: private void generateServiceFile(CodeGenerator generator, String serviceName, Path resourcePath, Filter filter)
focal_class.identifier: generateServiceFile
focal_class.modifiers: private
focal_class.parameters: (CodeGenerator generator, String serviceName, Path resourcePath, Filter filter)
focal_class.return: void
focal_class.signature: void generateServiceFile(CodeGenerator generator, String serviceName, Path resourcePath, Filter filter)
focal_class.class_method_signature: OpenApiCmd.generateBothFiles(CodeGenerator generator, String fileName, Path resourcePath, Filter filter)
focal_class.full_signature: private void generateBothFiles(CodeGenerator generator, String fileName, Path resourcePath, Filter filter)
focal_class.identifier: generateBothFiles
focal_class.modifiers: private
focal_class.parameters: (CodeGenerator generator, String fileName, Path resourcePath, Filter filter)
focal_class.return: void
focal_class.signature: void generateBothFiles(CodeGenerator generator, String fileName, Path resourcePath, Filter filter)
focal_class.class_method_signature: OpenApiCmd.checkModuleExist(String moduleName)
focal_class.full_signature: private boolean checkModuleExist(String moduleName)
focal_class.identifier: checkModuleExist
focal_class.modifiers: private
focal_class.parameters: (String moduleName)
focal_class.return: boolean
focal_class.signature: boolean checkModuleExist(String moduleName)
focal_class.class_method_signature: OpenApiCmd.getName()
focal_class.full_signature: @Override public String getName()
focal_class.identifier: getName
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String getName()
focal_class.class_method_signature: OpenApiCmd.printLongDesc(StringBuilder out)
focal_class.full_signature: @Override public void printLongDesc(StringBuilder out)
focal_class.identifier: printLongDesc
focal_class.modifiers: @Override public
focal_class.parameters: (StringBuilder out)
focal_class.return: void
focal_class.signature: void printLongDesc(StringBuilder out)
focal_class.class_method_signature: OpenApiCmd.printUsage(StringBuilder stringBuilder)
focal_class.full_signature: @Override public void printUsage(StringBuilder stringBuilder)
focal_class.identifier: printUsage
focal_class.modifiers: @Override public
focal_class.parameters: (StringBuilder stringBuilder)
focal_class.return: void
focal_class.signature: void printUsage(StringBuilder stringBuilder)
focal_class.class_method_signature: OpenApiCmd.setParentCmdParser(CommandLine parentCmdParser)
focal_class.full_signature: @Override public void setParentCmdParser(CommandLine parentCmdParser)
focal_class.identifier: setParentCmdParser
focal_class.modifiers: @Override public
focal_class.parameters: (CommandLine parentCmdParser)
focal_class.return: void
focal_class.signature: void setParentCmdParser(CommandLine parentCmdParser)
focal_method.body: @Override
      public void execute() {
          //User notification of using an experimental tool
          outStream.println(OpenApiMesseges.EXPERIMENTAL_FEATURE);
          if (helpFlag) {
              String commandUsageInfo = BLauncherCmd.getCommandUsageInfo(getName());
              outStream.println(commandUsageInfo);
              return;
          }
          //Check if cli input argument is present
          if (inputPath) {
              //Check if an OpenApi definition is provided
              if (argList == null) {
                  throw LauncherUtils.createLauncherException(OpenApiMesseges.MESSAGE_FOR_MISSING_INPUT);
              }
              // If given input is yaml contract, it generates service file and client stub
              // else if given ballerina service file it generates openapi contract file
              // else it generates error message to enter correct input file
              String fileName = argList.get(0);
              if (fileName.endsWith(".yaml") || fileName.endsWith(".json")) {
                  List<String> tag = new ArrayList<>();
                  List<String> operation = new ArrayList<>();
                  if (tags != null) {
                       tag.addAll(Arrays.asList(tags.split(",")));
                  }
                  if (operations != null) {
                      operation.addAll(Arrays.asList(operations.split(",")));
                  }
                  Filter filter = new Filter(tag, operation);
                  openApiToBallerina(fileName, filter);
              } else if (fileName.endsWith(".bal")) {
                  ballerinaToOpenApi(fileName);
              } else {
                  throw LauncherUtils.createLauncherException(OpenApiMesseges.MESSAGE_FOR_MISSING_INPUT);
              }
          } else {
              String commandUsageInfo = BLauncherCmd.getCommandUsageInfo(getName());
              outStream.println(commandUsageInfo);
              return;
          }
      }
focal_method.class_method_signature: OpenApiCmd.execute()
focal_method.full_signature: @Override public void execute()
focal_method.identifier: execute
focal_method.invocations: println getCommandUsageInfo getName println createLauncherException get endsWith endsWith addAll asList split addAll asList split openApiToBallerina endsWith ballerinaToOpenApi createLauncherException getCommandUsageInfo getName println
focal_method.modifiers: @Override public
focal_method.parameters: ()
focal_method.return: void
focal_method.signature: void execute()