Skip to content

Commit

Permalink
fix Issue 21 Options in docs
Browse files Browse the repository at this point in the history
  • Loading branch information
eviltester committed Jul 10, 2024
1 parent 25cab31 commit 6f28b82
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ public class ApiDocsConfig {
private String headerSectionAppend;
private String headerSectionOverride;
private String apiIntroductionParaOverride;
private boolean hideOptionsVerb;

public ApiDocsConfig(){
headerSectionAppend = "";
headerSectionOverride= "";
apiIntroductionParaOverride = "";
hideOptionsVerb=false;

}

Expand All @@ -32,6 +34,12 @@ public ApiDocsConfig setHeaderSectionOverride(String headerSection) {
return this;
}

public ApiDocsConfig showOptionsVerb(boolean show) {
this.hideOptionsVerb = !show;
return this;
}


public String apiIntroductionParaOverride() {
return "";
}
Expand All @@ -40,4 +48,8 @@ public ApiDocsConfig setApiIntroductionParaOverride(String introductionParaOverr
apiIntroductionParaOverride = introductionParaOverride;
return this;
}

public boolean ignoreOptionsVerb() {
return hideOptionsVerb;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,11 @@ public String getApiDocumentation(final ApiRoutingDefinition routingDefinitions,
}
if (routingDefn.status().isReturnedFromCall() || routingDefn.status().value() != 405) {
// ignore options
if (routingDefn.verb() != RoutingVerb.OPTIONS) {
boolean show = true;
if(thingifier.apidocsconfig().ignoreOptionsVerb() && routingDefn.verb() == RoutingVerb.OPTIONS){
show = false;
}
if (show) {
output.append(String.format("<ul>%n<li class='endpoint'>%n<strong>%s /%s</strong><ul><li class='normal'>%s</li></ul></li>%n</ul>",
routingDefn.verb(), routingDefn.url(), routingDefn.getDocumentation()));

Expand Down

0 comments on commit 6f28b82

Please sign in to comment.