Skip to content

Commit

Permalink
Merge pull request #38956 from msillence/tryitout
Browse files Browse the repository at this point in the history
Add swagger try-it-out option
  • Loading branch information
gastaldi authored Feb 22, 2024
2 parents 2b9c52a + c7e036e commit d2138c1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -357,4 +357,9 @@ public class SwaggerUiConfig {
@ConfigItem(defaultValue = "false")
boolean queryConfigEnabled;

/**
* If try it out should be enabled by default
*/
@ConfigItem(defaultValue = "false")
boolean tryItOutEnabled;
}
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,9 @@ private byte[] generateIndexHtml(String openApiPath, String swaggerUiPath, Swagg
String preauthorizeApiKeyApiKeyValue = swaggerUiConfig.preauthorizeApiKeyApiKeyValue.get();
options.put(Option.preauthorizeApiKeyApiKeyValue, preauthorizeApiKeyApiKeyValue);
}
if (swaggerUiConfig.tryItOutEnabled) {
options.put(Option.tryItOutEnabled, "true");
}

return IndexHtmlCreator.createIndexHtml(urlsMap, swaggerUiConfig.urlsPrimaryName.orElse(null), options);
}
Expand Down

0 comments on commit d2138c1

Please sign in to comment.