Skip to content

Commit 4918aac

Browse files
generate code after opt processing
petstore sample update
1 parent ffb3bda commit 4918aac

File tree

4 files changed

+64
-7
lines changed

4 files changed

+64
-7
lines changed

modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/ErlangServerCodegen.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,15 @@ public ErlangServerCodegen() {
110110
*/
111111
additionalProperties.put("apiVersion", apiVersion);
112112
additionalProperties.put("apiPath", apiPath);
113+
}
114+
115+
@Override
116+
public void processOpts() {
117+
super.processOpts();
118+
119+
if (additionalProperties.containsKey(CodegenConstants.PACKAGE_NAME)) {
120+
setPackageName((String) additionalProperties.get(CodegenConstants.PACKAGE_NAME));
121+
}
113122
/**
114123
* Supporting Files. You can write single files for the generator with the
115124
* entire object tree available. If the input file has a suffix of `.mustache
@@ -182,7 +191,7 @@ public String toApiName(String name) {
182191
* @return the escaped term
183192
*/
184193
@Override
185-
public String escapeReservedWord(String name) {
194+
public String escapeReservedWord(String name) {
186195
if(this.reservedWordsMappings().containsKey(name)) {
187196
return this.reservedWordsMappings().get(name);
188197
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.3.0
1+
2.4.0-SNAPSHOT
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.2.3-SNAPSHOT
1+
2.4.0-SNAPSHOT

samples/server/petstore/erlang-server/priv/swagger.json

Lines changed: 52 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@
108108
"type" : "array",
109109
"items" : {
110110
"type" : "string",
111-
"enum" : [ "available", "pending", "sold" ],
112-
"default" : "available"
111+
"default" : "available",
112+
"enum" : [ "available", "pending", "sold" ]
113113
},
114114
"collectionFormat" : "csv"
115115
} ],
@@ -563,7 +563,7 @@
563563
"parameters" : [ {
564564
"name" : "username",
565565
"in" : "path",
566-
"description" : "The name that needs to be fetched. Use user1 for testing. ",
566+
"description" : "The name that needs to be fetched. Use user1 for testing.",
567567
"required" : true,
568568
"type" : "string"
569569
} ],
@@ -684,6 +684,14 @@
684684
},
685685
"title" : "Pet Order",
686686
"description" : "An order for a pets from the pet store",
687+
"example" : {
688+
"petId" : 6,
689+
"quantity" : 1,
690+
"id" : 0,
691+
"shipDate" : "2000-01-23T04:56:07.000+00:00",
692+
"complete" : false,
693+
"status" : "placed"
694+
},
687695
"xml" : {
688696
"name" : "Order"
689697
}
@@ -701,6 +709,10 @@
701709
},
702710
"title" : "Pet category",
703711
"description" : "A category for a pet",
712+
"example" : {
713+
"name" : "name",
714+
"id" : 6
715+
},
704716
"xml" : {
705717
"name" : "Category"
706718
}
@@ -738,6 +750,16 @@
738750
},
739751
"title" : "a User",
740752
"description" : "A User who is purchasing from the pet store",
753+
"example" : {
754+
"firstName" : "firstName",
755+
"lastName" : "lastName",
756+
"password" : "password",
757+
"userStatus" : 6,
758+
"phone" : "phone",
759+
"id" : 0,
760+
"email" : "email",
761+
"username" : "username"
762+
},
741763
"xml" : {
742764
"name" : "User"
743765
}
@@ -755,6 +777,10 @@
755777
},
756778
"title" : "Pet Tag",
757779
"description" : "A tag for a pet",
780+
"example" : {
781+
"name" : "name",
782+
"id" : 1
783+
},
758784
"xml" : {
759785
"name" : "Tag"
760786
}
@@ -802,6 +828,23 @@
802828
},
803829
"title" : "a Pet",
804830
"description" : "A pet for sale in the pet store",
831+
"example" : {
832+
"photoUrls" : [ "photoUrls", "photoUrls" ],
833+
"name" : "doggie",
834+
"id" : 0,
835+
"category" : {
836+
"name" : "name",
837+
"id" : 6
838+
},
839+
"tags" : [ {
840+
"name" : "name",
841+
"id" : 1
842+
}, {
843+
"name" : "name",
844+
"id" : 1
845+
} ],
846+
"status" : "available"
847+
},
805848
"xml" : {
806849
"name" : "Pet"
807850
}
@@ -821,7 +864,12 @@
821864
}
822865
},
823866
"title" : "An uploaded response",
824-
"description" : "Describes the result of uploading an image resource"
867+
"description" : "Describes the result of uploading an image resource",
868+
"example" : {
869+
"code" : 0,
870+
"type" : "type",
871+
"message" : "message"
872+
}
825873
}
826874
},
827875
"externalDocs" : {

0 commit comments

Comments
 (0)