swagger-api / swagger-api/swagger-codegen

Collect errors and throw instead of just logging them

Open
#10,854 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Similar to https://github.com/swagger-api/swagger-parser/issues/1515 and https://github.com/swagger-api/swagger-codegen/issues/10853, we want to be able to call SwaggerCodegen.main programmatically.

But errors are often just logged instead of an exception being thrown, which doesn't work for non-interactive use cases.

We'd very much like to be able to pass in an option that results in messages being collected and then an exception thrown at the end (they can still be logged as well).

We tried to do this by replacing the logger, but that conflicted with Gradle's logger.

I filed this as well as https://github.com/swagger-api/swagger-parser/issues/1515 because https://github.com/swagger-api/swagger-parser/issues/1515 is specifically about the parser's behavior. Here, we are concerned with the parser, and the codegen configs, and the call to mustache, and anything else in the codepath that encounters a problem.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at SwaggerCodegen.main and trace the parser, codegen configuration, Mustache, and other components in its execution path that currently log problems. Define how the new option is passed through this path and verify that messages remain loggable while being collected and reported by an exception at the end for programmatic callers.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.