Skip to content

Commit 682cf01

Browse files
authored
Merge branch 'master' into issue-10125
2 parents d350261 + fd7e6d8 commit 682cf01

File tree

14 files changed

+125
-59
lines changed

14 files changed

+125
-59
lines changed

modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenModel.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ public class CodegenModel {
4040

4141
public Set<String> imports = new TreeSet<String>();
4242
public boolean hasVars, emptyVars, hasMoreModels, hasEnums, isEnum, hasRequired, hasOptional, isArrayModel, hasChildren;
43+
public CodegenProperty parentContainer;
4344
public boolean hasOnlyReadOnly = true; // true if all properties are read-only
4445
public ExternalDocs externalDocs;
4546

modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenProperty.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ public class CodegenProperty implements Cloneable {
4646
public List<String> _enum;
4747
public Map<String, Object> allowableValues;
4848
public CodegenProperty items;
49+
public Integer itemsDepth;
4950
public Map<String, Object> vendorExtensions;
5051
public boolean hasValidation; // true if pattern, maximum, etc are set (only used in the mustache template)
5152
public boolean isInherited;

modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1604,12 +1604,24 @@ public String getterAndSetterCapitalize(String name) {
16041604
* @return Codegen Property object
16051605
*/
16061606
public CodegenProperty fromProperty(String name, Property p) {
1607+
return fromProperty(name, p, null);
1608+
}
1609+
/**
1610+
* Convert Swagger Property object to Codegen Property object
1611+
*
1612+
* @param name name of the property
1613+
* @param p Swagger property object
1614+
* @param itemsDepth the depth in nested containers or null
1615+
* @return Codegen Property object
1616+
*/
1617+
private CodegenProperty fromProperty(String name, Property p, Integer itemsDepth) {
16071618
if (p == null) {
16081619
LOGGER.error("unexpected missing property for name " + name);
16091620
return null;
16101621
}
16111622

16121623
CodegenProperty property = CodegenModelFactory.newInstance(CodegenModelType.PROPERTY);
1624+
property.itemsDepth = itemsDepth;
16131625
property.name = toVarName(name);
16141626
property.baseName = name;
16151627
property.nameInCamelCase = camelize(property.name, false);
@@ -1873,7 +1885,8 @@ public CodegenProperty fromProperty(String name, Property p) {
18731885
if (itemName == null) {
18741886
itemName = property.name;
18751887
}
1876-
CodegenProperty cp = fromProperty(itemName, ap.getItems());
1888+
CodegenProperty cp = fromProperty(itemName, ap.getItems(),
1889+
itemsDepth == null ? 1 : itemsDepth.intValue() + 1);
18771890
updatePropertyForArray(property, cp);
18781891
} else if (p instanceof MapProperty) {
18791892
MapProperty ap = (MapProperty) p;
@@ -1886,7 +1899,8 @@ public CodegenProperty fromProperty(String name, Property p) {
18861899
property.maxItems = ap.getMaxProperties();
18871900

18881901
// handle inner property
1889-
CodegenProperty cp = fromProperty("inner", ap.getAdditionalProperties());
1902+
CodegenProperty cp = fromProperty("inner", ap.getAdditionalProperties(),
1903+
itemsDepth == null ? 1 : itemsDepth.intValue() + 1);
18901904
updatePropertyForMap(property, cp);
18911905
} else {
18921906
setNonArrayMapProperty(property, type);
@@ -3090,10 +3104,10 @@ public void addOperationToGroup(String tag, String resourcePath, Operation opera
30903104
}
30913105

30923106
private void addParentContainer(CodegenModel m, String name, Property property) {
3093-
final CodegenProperty tmp = fromProperty(name, property);
3094-
addImport(m, tmp.complexType);
3107+
m.parentContainer = fromProperty(name, property);
3108+
addImport(m, m.parentContainer.complexType);
30953109
m.parent = toInstantiationType(property);
3096-
final String containerType = tmp.containerType;
3110+
final String containerType = m.parentContainer.containerType;
30973111
final String instantiationType = instantiationTypes.get(containerType);
30983112
if (instantiationType != null) {
30993113
addImport(m, instantiationType);

modules/swagger-codegen/src/main/resources/ruby/Gemfile.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ source 'https://rubygems.org'
33
gemspec
44

55
group :development, :test do
6-
gem 'rake', '~> 12.0.0'
6+
gem 'rake', '~> 12.3.3'
77
end

modules/swagger-codegen/src/main/resources/typescript-node/package.mustache

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
"@types/request": "*"
2020
},
2121
"devDependencies": {
22-
"typescript": "^2.4.2"
22+
"typescript": "^2.4.2",
23+
"minimist": "^1.2.5"
2324
}{{#npmRepository}},
2425
"publishConfig":{
2526
"registry":"{{npmRepository}}"

samples/client/petstore-security-test/ruby/Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ source 'https://rubygems.org'
33
gemspec
44

55
group :development, :test do
6-
gem 'rake', '~> 12.0.0'
6+
gem 'rake', '~> 12.3.3'
77
end

samples/client/petstore/ruby/Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ source 'https://rubygems.org'
33
gemspec
44

55
group :development, :test do
6-
gem 'rake', '~> 12.0.0'
6+
gem 'rake', '~> 12.3.3'
77
end

samples/client/petstore/ruby/Gemfile.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ GEM
2626
hashdiff (0.3.4)
2727
json (2.1.0)
2828
public_suffix (2.0.5)
29-
rake (12.0.0)
29+
rake (12.3.3)
3030
rspec (3.6.0)
3131
rspec-core (~> 3.6.0)
3232
rspec-expectations (~> 3.6.0)
@@ -60,7 +60,7 @@ DEPENDENCIES
6060
autotest-growl (~> 0.2, >= 0.2.16)
6161
autotest-rails-pure (~> 4.1, >= 4.1.2)
6262
petstore!
63-
rake (~> 12.0.0)
63+
rake (~> 12.3.3)
6464
rspec (~> 3.6, >= 3.6.0)
6565
vcr (~> 3.0, >= 3.0.1)
6666
webmock (~> 1.24, >= 1.24.3)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.4.3-SNAPSHOT
1+
2.4.14-SNAPSHOT

samples/client/petstore/typescript-node/npm/api.d.ts

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -193,35 +193,35 @@ export declare class PetApi {
193193
setDefaultAuthentication(auth: Authentication): void;
194194
setApiKey(key: PetApiApiKeys, value: string): void;
195195
accessToken: string;
196-
addPet(body: Pet): Promise<{
196+
addPet(body: Pet, options?: any): Promise<{
197197
response: http.ClientResponse;
198198
body?: any;
199199
}>;
200-
deletePet(petId: number, apiKey?: string): Promise<{
200+
deletePet(petId: number, apiKey?: string, options?: any): Promise<{
201201
response: http.ClientResponse;
202202
body?: any;
203203
}>;
204-
findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>): Promise<{
204+
findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, options?: any): Promise<{
205205
response: http.ClientResponse;
206206
body: Array<Pet>;
207207
}>;
208-
findPetsByTags(tags: Array<string>): Promise<{
208+
findPetsByTags(tags: Array<string>, options?: any): Promise<{
209209
response: http.ClientResponse;
210210
body: Array<Pet>;
211211
}>;
212-
getPetById(petId: number): Promise<{
212+
getPetById(petId: number, options?: any): Promise<{
213213
response: http.ClientResponse;
214214
body: Pet;
215215
}>;
216-
updatePet(body: Pet): Promise<{
216+
updatePet(body: Pet, options?: any): Promise<{
217217
response: http.ClientResponse;
218218
body?: any;
219219
}>;
220-
updatePetWithForm(petId: number, name?: string, status?: string): Promise<{
220+
updatePetWithForm(petId: number, name?: string, status?: string, options?: any): Promise<{
221221
response: http.ClientResponse;
222222
body?: any;
223223
}>;
224-
uploadFile(petId: number, additionalMetadata?: string, file?: Buffer): Promise<{
224+
uploadFile(petId: number, additionalMetadata?: string, file?: Buffer, options?: any): Promise<{
225225
response: http.ClientResponse;
226226
body: ApiResponse;
227227
}>;
@@ -244,21 +244,21 @@ export declare class StoreApi {
244244
setDefaultAuthentication(auth: Authentication): void;
245245
setApiKey(key: StoreApiApiKeys, value: string): void;
246246
accessToken: string;
247-
deleteOrder(orderId: string): Promise<{
247+
deleteOrder(orderId: string, options?: any): Promise<{
248248
response: http.ClientResponse;
249249
body?: any;
250250
}>;
251-
getInventory(): Promise<{
251+
getInventory(options?: any): Promise<{
252252
response: http.ClientResponse;
253253
body: {
254254
[key: string]: number;
255255
};
256256
}>;
257-
getOrderById(orderId: number): Promise<{
257+
getOrderById(orderId: number, options?: any): Promise<{
258258
response: http.ClientResponse;
259259
body: Order;
260260
}>;
261-
placeOrder(body: Order): Promise<{
261+
placeOrder(body: Order, options?: any): Promise<{
262262
response: http.ClientResponse;
263263
body: Order;
264264
}>;
@@ -281,35 +281,35 @@ export declare class UserApi {
281281
setDefaultAuthentication(auth: Authentication): void;
282282
setApiKey(key: UserApiApiKeys, value: string): void;
283283
accessToken: string;
284-
createUser(body: User): Promise<{
284+
createUser(body: User, options?: any): Promise<{
285285
response: http.ClientResponse;
286286
body?: any;
287287
}>;
288-
createUsersWithArrayInput(body: Array<User>): Promise<{
288+
createUsersWithArrayInput(body: Array<User>, options?: any): Promise<{
289289
response: http.ClientResponse;
290290
body?: any;
291291
}>;
292-
createUsersWithListInput(body: Array<User>): Promise<{
292+
createUsersWithListInput(body: Array<User>, options?: any): Promise<{
293293
response: http.ClientResponse;
294294
body?: any;
295295
}>;
296-
deleteUser(username: string): Promise<{
296+
deleteUser(username: string, options?: any): Promise<{
297297
response: http.ClientResponse;
298298
body?: any;
299299
}>;
300-
getUserByName(username: string): Promise<{
300+
getUserByName(username: string, options?: any): Promise<{
301301
response: http.ClientResponse;
302302
body: User;
303303
}>;
304-
loginUser(username: string, password: string): Promise<{
304+
loginUser(username: string, password: string, options?: any): Promise<{
305305
response: http.ClientResponse;
306306
body: string;
307307
}>;
308-
logoutUser(): Promise<{
308+
logoutUser(options?: any): Promise<{
309309
response: http.ClientResponse;
310310
body?: any;
311311
}>;
312-
updateUser(username: string, body: User): Promise<{
312+
updateUser(username: string, body: User, options?: any): Promise<{
313313
response: http.ClientResponse;
314314
body?: any;
315315
}>;

0 commit comments

Comments
 (0)