swagger-api / swagger-api/swagger-codegen

[Java][Feature Request]Show app description only if flown in client opts.

Open
#7,579 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

As per DefaultGenerator class, if the config flown by client does not have an app description, the default description is set to "No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)"
Shouldn't there be a capability to show description only if flown in config? And show nothing if there is no description in the config. The above text looks out of context in the documentation generated for an api.

Swagger-codegen version

2.2.1

Swagger declaration file content or url
https://gist.github.com/vyshnavi-pilly/cefac3a7c1fab912e09fa0bbac62b7e9
Command line used for generation

ClientOptInput clientOptInput = new ClientOptInput();
clientOptInput.setConfig(config);
new DefaultGenerator().opts(clientOptInput).generate();

Steps to reproduce
  1. Input the provided json to swagger codegen
  2. As there is no app level description the generated html shows the app description as "No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)"
Suggest a fix/enhancement

Here is the piece of code causing this:
if (StringUtils.isEmpty(info.getDescription())) {
// set a default description if none if provided
config.additionalProperties().put("appDescription",
"No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)");
config.additionalProperties().put("unescapedAppDescription", "No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)");
} else {
config.additionalProperties().put("appDescription", config.escapeText(info.getDescription()));
config.additionalProperties().put("unescapedAppDescription", info.getDescription());
}

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 the DefaultGenerator logic shown in the issue and reproduce the generated HTML using the linked Swagger declaration and ClientOptInput command. Check how appDescription and unescapedAppDescription are consumed in the generated documentation. Done means an absent config description produces no default text, while a supplied description remains displayed.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
documentation
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.