Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Merge requests
  • !5428

[Ruby] Add error output

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Administrator requested to merge github/fork/ackintosh/error-output into master Feb 25, 2020
  • Overview 0
  • Commits 2
  • Pipelines 0
  • Changes 1

Created by: ackintosh

Related issue: https://github.com/OpenAPITools/openapi-generator/issues/5417

Add error output to the log so that we can make sure why the error occured, when the command passed via RUBY_POST_PROCESS_FILE failed.

PR checklist

  • Read the contribution guidelines.
  • If contributing template-only or documentation-only changes which will change sample output, build the project before.
  • Run the shell script(s) under ./bin/ (or Windows batch scripts under.\bin\windows) to update Petstore samples related to your fix. This is important, as CI jobs will verify all generator outputs of your HEAD commit, and these must match the expectations made by your contribution. You only need to run ./bin/{LANG}-petstore.sh, ./bin/openapi3/{LANG}-petstore.sh if updating the code or mustache templates for a language ({LANG}) (e.g. php, ruby, python, etc).
  • File the PR against the correct branch: master, 4.3.x, 5.0.x. Default: master.
  • Copy the technical committee to review the pull request if your PR is targeting a particular programming language.
# Rubocop
$ which rubocop
/usr/local/bin/rubocop
$ rubocop -v
0.80.0

# Generate ruby client with a RUBY_POST_PROCESS_FILE environment variable
$ env RUBY_POST_PROCESS_FILE="/usr/local/bin/rubocop -a" \
  java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar \
  generate \
  -g ruby \
  -o /tmp/issue/5417 \
  -i http://petstore.swagger.io:8080/api/v3/openapi.json \
  --enable-post-process-file

Before:

[main] ERROR o.o.c.languages.AbstractRubyCodegen - Error running the command (/usr/local/bin/rubocop -a /tmp/issue/5417/lib/openapi_client/models/address.rb). Exit value: 2

After: the error output shows why rubocop resulted in error

[main] ERROR o.o.c.languages.AbstractRubyCodegen - Error running the command (/usr/local/bin/rubocop -a /tmp/issue/5417/lib/openapi_client/api_client.rb). Exit value: 2, Error output: Error: The `Layout/IndentFirstArgument` cop has been renamed to `Layout/FirstArgumentIndentation`.(obsolete configuration found in /tmp/issue/5417/.rubocop.yml, please update it)The `Layout/TrailingBlankLines` cop has been renamed to `Layout/TrailingEmptyLines`.(obsolete configuration found in /tmp/issue/5417/.rubocop.yml, please update it)The `Style/UnneededPercentQ` cop has been renamed to `Style/RedundantPercentQ`.(obsolete configuration found in /tmp/issue/5417/.rubocop.yml, please update it)The `Style/BracesAroundHashParameters` cop has been removed.(obsolete configuration found in /tmp/issue/5417/.rubocop.yml, please update it)obsolete `EnforcedStyle: rails` (for Layout/IndentationConsistency) found in /tmp/issue/5417/.rubocop.yml`EnforcedStyle: rails` has been renamed to `EnforcedStyle: indented_internal_methods`
Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/ackintosh/error-output