swagger-api / swagger-api/swagger-codegen

[JAVA] Useless error message when invalid combination of options are set

Open
#10,475 0 comments 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

Description

When setting certain options that are incompatible with each other, code gen brings up a useless error message that offers no help in fixing the problem

Swagger-codegen version

Swagger 2.0, OpenAPI 3.0

Swagger declaration file content or url

(use default petstore demo .yaml file.)

Command line used for generation

In the editor at app.swaggerhub.com, go to the Export menu and choose Server Stub: spring

Steps to reproduce
  1. Use the standard Swagger Petstore yaml file.
  2. Go to Export:CodeGen Options, choose Spring, and set the following options:
    InterfaceOnly
    DelegatePattern
  3. Go to Export: Server-Stub, and choose Spring. This will pop up this error message:
    There was an error generating the servers spring code. Please ensure that the definition and all external refs (inc. domains) are valid.

This is a useless error message. It implies the problem is with the .yaml file, when the problem is actually with incompatible options. Please provide a better error message, that tells which options are not compatible.

Suggest a fix/enhancement

provide an error message saying "InterfaceOnly and DelegatePattern options are incompatible with each other."

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

Reproduce the failure with the standard Petstore YAML, the Spring server target, and the InterfaceOnly and DelegatePattern options enabled. Start by tracing Spring server generation and option validation; done means the incompatible options are identified in the error instead of producing a misleading definition or external-reference message.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
backend, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.