diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenModel.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenModel.java index 6d32d54f3f9..118de425c93 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenModel.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenModel.java @@ -18,7 +18,7 @@ public class CodegenModel { public CodegenModel parentModel; public List interfaceModels; - public String name, classname, description, classVarName, modelJson, dataType; + public String name, classname, title, description, classVarName, modelJson, dataType; public String classFilename; // store the class file name, mainly used for import public String unescapedDescription; public String discriminator; @@ -80,6 +80,8 @@ public class CodegenModel { return false; if (classname != null ? !classname.equals(that.classname) : that.classname != null) return false; + if (title != null ? !title.equals(that.title) : that.title != null) + return false; if (description != null ? !description.equals(that.description) : that.description != null) return false; if (classVarName != null ? !classVarName.equals(that.classVarName) : that.classVarName != null) @@ -143,6 +145,7 @@ public class CodegenModel { result = 31 * result + (interfaceModels != null ? interfaceModels.hashCode() : 0); result = 31 * result + (name != null ? name.hashCode() : 0); result = 31 * result + (classname != null ? classname.hashCode() : 0); + result = 31 * result + (title != null ? title.hashCode() : 0); result = 31 * result + (description != null ? description.hashCode() : 0); result = 31 * result + (classVarName != null ? classVarName.hashCode() : 0); result = 31 * result + (modelJson != null ? modelJson.hashCode() : 0); diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java index d49caf075cd..3a8d0095208 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java @@ -1205,6 +1205,7 @@ public class DefaultCodegen { } else { m.name = name; } + m.title = escapeText(model.getTitle()); m.description = escapeText(model.getDescription()); m.unescapedDescription = model.getDescription(); m.classname = toModelName(name); diff --git a/modules/swagger-codegen/src/main/resources/htmlDocs/index.mustache b/modules/swagger-codegen/src/main/resources/htmlDocs/index.mustache index b94414d5b26..3c49831c8e8 100644 --- a/modules/swagger-codegen/src/main/resources/htmlDocs/index.mustache +++ b/modules/swagger-codegen/src/main/resources/htmlDocs/index.mustache @@ -162,7 +162,8 @@ {{#models}} {{#model}}
-

{{name}} Up

+

{{name}} - {{title}} Up

+
{{description}}
{{#vars}}
{{name}} {{^required}}(optional){{/required}}
{{^isPrimitiveType}}{{datatype}}{{/isPrimitiveType}} {{description}} {{#dataFormat}}format: {{{dataFormat}}}{{/dataFormat}}
{{#isEnum}} diff --git a/modules/swagger-codegen/src/test/resources/2_0/petstore.yaml b/modules/swagger-codegen/src/test/resources/2_0/petstore.yaml index 73493835106..cd10223ba04 100644 --- a/modules/swagger-codegen/src/test/resources/2_0/petstore.yaml +++ b/modules/swagger-codegen/src/test/resources/2_0/petstore.yaml @@ -573,6 +573,8 @@ securityDefinitions: in: header definitions: Order: + title: Pet Order + description: An order for a pets from the pet store type: object properties: id: @@ -600,6 +602,8 @@ definitions: xml: name: Order Category: + title: Pet catehgry + description: A category for a pet type: object properties: id: @@ -610,6 +614,8 @@ definitions: xml: name: Category User: + title: a User + description: A User who is purchasing from the pet store type: object properties: id: @@ -634,6 +640,8 @@ definitions: xml: name: User Tag: + title: Pet Tag + description: A tag for a pet type: object properties: id: @@ -644,6 +652,8 @@ definitions: xml: name: Tag Pet: + title: a Pet + description: A pet for sale in the pet store type: object required: - name @@ -681,6 +691,8 @@ definitions: xml: name: Pet ApiResponse: + title: An uploaded response + description: Describes the result of uploading an image resource type: object properties: code: diff --git a/samples/html/index.html b/samples/html/index.html index 7ab2a9b0e98..f306462b99d 100644 --- a/samples/html/index.html +++ b/samples/html/index.html @@ -1265,7 +1265,8 @@ font-style: italic;
-

ApiResponse Up

+

ApiResponse - An uploaded response Up

+
Describes the result of uploading an image resource
code (optional)
Integer format: int32
type (optional)
@@ -1273,14 +1274,16 @@ font-style: italic;
-

Category Up

+

Category - Pet catehory Up

+
A category for a pet
id (optional)
Long format: int64
name (optional)
-

Order Up

+

Order - Pet Order Up

+
An order for a pets from the pet store
id (optional)
Long format: int64
petId (optional)
Long format: int64
@@ -1293,7 +1296,8 @@ font-style: italic;
-

Pet Up

+

Pet - a Pet Up

+
A pet for sale in the pet store
id (optional)
Long format: int64
category (optional)
@@ -1306,14 +1310,16 @@ font-style: italic;
-

Tag Up

+

Tag - Pet Tag Up

+
A tag for a pet
id (optional)
Long format: int64
name (optional)
-

User Up

+

User - a User Up

+
A User who is purchasing from the pet store
id (optional)
Long format: int64
username (optional)