From bbe9510e0633f4defb84c0dec6fdd68c46a6b056 Mon Sep 17 00:00:00 2001 From: gracekarina Date: Sun, 25 Sep 2022 08:56:38 -0500 Subject: [PATCH] adding parser version as parameter --- .github/actions/action.yml | 7 +++++-- .github/workflows/validate-workflow.yml | 1 + .../src/main/java/io/swagger/v3/parser/SwaggerParser.java | 1 - 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/actions/action.yml b/.github/actions/action.yml index 571cd32a00..ae316464d3 100644 --- a/.github/actions/action.yml +++ b/.github/actions/action.yml @@ -16,6 +16,9 @@ inputs: parserSpecPath: description: 'output path of the serialized parsed definition' required: false + parserVersion: + description: 'parser version' + required: false runs: using: "composite" steps: @@ -29,9 +32,9 @@ runs: distribution: 'zulu' java-version: '11' - name: Download JAR - run: curl -L "https://oss.sonatype.org/service/local/repositories/snapshots/content/io/swagger/parser/v3/swagger-parser-cli/2.1.3-SNAPSHOT/swagger-parser-cli-2.1.3-20220917.171959-2.jar" -o swagger-parser-cli.jar + run: curl -L 'https://repository.sonatype.org/service/local/artifact/maven/content?r=central-proxy&g=io.swagger.parser.v3&a=swagger-parser-cli&e=jar&v=${{ inputs.parserVersion }}' -o swagger-parser-cli.jar shell: bash - id: execute name: Execute Jar - run: java -jar swagger-parser-cli.jar ${{ inputs.inputSpec }} ${{ inputs.options }} ${{ inputs.serializationType }} -o ${{ inputs.parserSpecPath }} -l ${{ inputs.logsPath }} + run: java -jar swagger-parser-cli.jar -i ${{ inputs.inputSpec }} ${{ inputs.options }} ${{ inputs.serializationType }} -o ${{ inputs.parserSpecPath }} -l ${{ inputs.logsPath }} shell: bash \ No newline at end of file diff --git a/.github/workflows/validate-workflow.yml b/.github/workflows/validate-workflow.yml index f9a8d31f9c..8c35c43e3a 100644 --- a/.github/workflows/validate-workflow.yml +++ b/.github/workflows/validate-workflow.yml @@ -14,6 +14,7 @@ jobs: with: inputSpec: '/home/runner/work/swagger-parser/swagger-parser/modules/swagger-parser-cli/src/test/resources/fileWithNoErrorMessages.yaml' options: '-resolve -resolveFully' + parserVersion: '2.1.2' serializationType: '-json' logsPath: '/home/runner/work/swagger-parser/swagger-parser/modules/swagger-parser-cli/target/test-classes/parserLogs.yaml' parserSpecPath: '/home/runner/work/swagger-parser/swagger-parser/modules/swagger-parser-cli/target/test-classes/specParsed.json' diff --git a/modules/swagger-parser-cli/src/main/java/io/swagger/v3/parser/SwaggerParser.java b/modules/swagger-parser-cli/src/main/java/io/swagger/v3/parser/SwaggerParser.java index 2593f01392..904a31362c 100644 --- a/modules/swagger-parser-cli/src/main/java/io/swagger/v3/parser/SwaggerParser.java +++ b/modules/swagger-parser-cli/src/main/java/io/swagger/v3/parser/SwaggerParser.java @@ -94,7 +94,6 @@ public static List readFromLocation(Namespace args) { if(args.getString("o") != null) { if (result.getOpenAPI() != null){ String output; - Yaml.prettyPrint(result.getOpenAPI()); if(args.getString("json") != null){ output = Json.pretty(result.getOpenAPI()); }else if(args.getString("yaml") != null){