From 632a2e394987b7463aef7bfda528e9675f255efa Mon Sep 17 00:00:00 2001 From: David Biesack Date: Thu, 18 May 2017 03:16:42 -0400 Subject: [PATCH] Fix #5653 so body parameter schema link matches model anchor (#5655) * Sync with upstream/master * Fix for issue #5653 Override the toModelName(String name) [from DefaultCodegen] in StaticHtmlGenerator to return `name` unmodified so that the anchors for models and the href for body parameters match case (do not convert model names to TitleCase. * Revert "Fix for issue #5653" This reverts commit 5472aa10a3101ea5dd417bc509c5d9c5351a3d66. * Fix for issue #5653 Override the toModelName(String name) [from DefaultCodegen] in StaticHtmlGenerator to return `name` unmodified so that the anchors for models and the href for body parameters match case (do not convert model names to TitleCase. --- .../io/swagger/codegen/languages/StaticHtmlGenerator.java | 8 ++++++++ samples/html/.swagger-codegen/VERSION | 1 + 2 files changed, 9 insertions(+) create mode 100644 samples/html/.swagger-codegen/VERSION diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/StaticHtmlGenerator.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/StaticHtmlGenerator.java index a22010e51fb..6942b3b2996 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/StaticHtmlGenerator.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/StaticHtmlGenerator.java @@ -170,6 +170,14 @@ public class StaticHtmlGenerator extends DefaultCodegen implements CodegenConfig return markdownConverter.toHtml(input); } + // DefaultCodegen converts model names to UpperCamelCase + // but for static HTML, we want the names to be preserved as coded in the OpenApi + // so HTML links work + @Override + public String toModelName(final String name) { + return name; + } + public void preprocessSwagger(Swagger swagger) { Info info = swagger.getInfo(); info.setDescription(toHtml(info.getDescription())); diff --git a/samples/html/.swagger-codegen/VERSION b/samples/html/.swagger-codegen/VERSION new file mode 100644 index 00000000000..7fea99011a6 --- /dev/null +++ b/samples/html/.swagger-codegen/VERSION @@ -0,0 +1 @@ +2.2.3-SNAPSHOT \ No newline at end of file