diff --git a/.github/actions/action.yml b/.github/actions/action.yml index 802258a8f3..571cd32a00 100644 --- a/.github/actions/action.yml +++ b/.github/actions/action.yml @@ -1,17 +1,20 @@ -name: 'Swagger Parser CLI' -description: 'Uses swagger parser CLI to allow validation of a definition' +name: 'Swagger Parser' +description: 'Parses, validates, dereferences an OpenAPI definition' inputs: inputSpec: - description: 'file of the openapi definition' + description: 'path to OpenAPI definition file' required: true options: description: 'parser options' required: false + serializationType: + description: 'result file serialization type' + required: false logsPath: - description: 'file of the logs messages or errors' - required: true + description: 'path to validation result file' + required: false parserSpecPath: - description: 'path where a file can be found with parsed definition' + description: 'output path of the serialized parsed definition' required: false runs: using: "composite" @@ -26,9 +29,9 @@ runs: distribution: 'zulu' java-version: '11' - name: Download 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=LATEST" -o swagger-parser-cli.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 shell: bash - id: execute name: Execute Jar - run: java -jar swagger-parser-cli.jar -i ${{ inputs.inputSpec }} ${{ inputs.options }} -o ${{ inputs.parserSpecPath }} -l ${{ inputs.logsPath }} + run: java -jar swagger-parser-cli.jar ${{ 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 9ee1f182b1..f9a8d31f9c 100644 --- a/.github/workflows/validate-workflow.yml +++ b/.github/workflows/validate-workflow.yml @@ -14,8 +14,11 @@ jobs: with: inputSpec: '/home/runner/work/swagger-parser/swagger-parser/modules/swagger-parser-cli/src/test/resources/fileWithNoErrorMessages.yaml' options: '-resolve -resolveFully' + 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.yaml' + parserSpecPath: '/home/runner/work/swagger-parser/swagger-parser/modules/swagger-parser-cli/target/test-classes/specParsed.json' + - run: cat /home/runner/work/swagger-parser/swagger-parser/modules/swagger-parser-cli/target/test-classes/specParsed.json + shell: bash 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 904a31362c..2593f01392 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,6 +94,7 @@ 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){