Skip to content

Correct exporting of enum classes #2126

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 16, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@

//export module
if ( typeof define === "function" && define.amd ) {
define('{{datatypeWithEnum}}', [], function() {
return {{datatypeWithEnum}};
});
}

var {{datatypeWithEnum}} = {
{{#allowableValues}}{{#enumVars}}
/**
* @const
*/
{{name}}: "{{value}}"{{^-last}},
{{/-last}}{{/enumVars}}{{/allowableValues}}
/**
* @const
*/
{{name}}: "{{value}}"{{^-last}},
{{/-last}}{{/enumVars}}{{/allowableValues}}
};

}
{{classname}}.{{datatypeWithEnum}} = {{datatypeWithEnum}};
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,7 @@
}
}(this, function(module, ApiClient{{#imports}}, {{import}}{{/imports}}) {
'use strict';

{{#models}}{{#model}}
{{#vars}}{{#isEnum}}{{>enumClass}}{{/isEnum}}{{#items.isEnum}}{{#items}}
{{>enumClass}}{{/items}}*/{{/items.isEnum}}{{/vars}}

{{#description}}/**
* {{description}}
**/{{/description}}
Expand Down Expand Up @@ -74,6 +70,9 @@
return JSON.stringify(this);
}

{{#vars}}{{#isEnum}}{{>enumClass}}{{/isEnum}}{{#items.isEnum}}{{#items}}
{{>enumClass}}{{/items}}*/{{/items.isEnum}}{{/vars}}

if (module) {
module.{{classname}} = {{classname}};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@
}
}(this, function(module, ApiClient) {
'use strict';





var Category = function Category() {

Expand Down Expand Up @@ -86,6 +83,8 @@
return JSON.stringify(this);
}



if (module) {
module.Category = Category;
}
Expand Down
50 changes: 21 additions & 29 deletions samples/client/petstore/javascript-promise/src/model/Order.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,37 +14,8 @@
}
}(this, function(module, ApiClient) {
'use strict';



//export module
if ( typeof define === "function" && define.amd ) {
define('StatusEnum', [], function() {
return StatusEnum;
});
}

var StatusEnum = {

/**
* @const
*/
PLACED: "placed",

/**
* @const
*/
APPROVED: "approved",

/**
* @const
*/
DELIVERED: "delivered"

}



var Order = function Order() {

/**
Expand Down Expand Up @@ -207,6 +178,27 @@ var StatusEnum = {
return JSON.stringify(this);
}

var StatusEnum = {

/**
* @const
*/
PLACED: "placed",

/**
* @const
*/
APPROVED: "approved",

/**
* @const
*/
DELIVERED: "delivered"
};

Order.StatusEnum = StatusEnum;


if (module) {
module.Order = Order;
}
Expand Down
50 changes: 21 additions & 29 deletions samples/client/petstore/javascript-promise/src/model/Pet.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,37 +14,8 @@
}
}(this, function(module, ApiClient, Category, Tag) {
'use strict';



//export module
if ( typeof define === "function" && define.amd ) {
define('StatusEnum', [], function() {
return StatusEnum;
});
}

var StatusEnum = {

/**
* @const
*/
AVAILABLE: "available",

/**
* @const
*/
PENDING: "pending",

/**
* @const
*/
SOLD: "sold"

}



var Pet = function Pet(photoUrls, name) {

/**
Expand Down Expand Up @@ -209,6 +180,27 @@ var StatusEnum = {
return JSON.stringify(this);
}

var StatusEnum = {

/**
* @const
*/
AVAILABLE: "available",

/**
* @const
*/
PENDING: "pending",

/**
* @const
*/
SOLD: "sold"
};

Pet.StatusEnum = StatusEnum;


if (module) {
module.Pet = Pet;
}
Expand Down
5 changes: 2 additions & 3 deletions samples/client/petstore/javascript-promise/src/model/Tag.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@
}
}(this, function(module, ApiClient) {
'use strict';





var Tag = function Tag() {

Expand Down Expand Up @@ -86,6 +83,8 @@
return JSON.stringify(this);
}



if (module) {
module.Tag = Tag;
}
Expand Down
5 changes: 2 additions & 3 deletions samples/client/petstore/javascript-promise/src/model/User.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@
}
}(this, function(module, ApiClient) {
'use strict';





var User = function User() {

Expand Down Expand Up @@ -227,6 +224,8 @@
return JSON.stringify(this);
}



if (module) {
module.User = User;
}
Expand Down
5 changes: 2 additions & 3 deletions samples/client/petstore/javascript/src/model/Category.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@
}
}(this, function(module, ApiClient) {
'use strict';





var Category = function Category() {

Expand Down Expand Up @@ -86,6 +83,8 @@
return JSON.stringify(this);
}



if (module) {
module.Category = Category;
}
Expand Down
50 changes: 21 additions & 29 deletions samples/client/petstore/javascript/src/model/Order.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,37 +14,8 @@
}
}(this, function(module, ApiClient) {
'use strict';



//export module
if ( typeof define === "function" && define.amd ) {
define('StatusEnum', [], function() {
return StatusEnum;
});
}

var StatusEnum = {

/**
* @const
*/
PLACED: "placed",

/**
* @const
*/
APPROVED: "approved",

/**
* @const
*/
DELIVERED: "delivered"

}



var Order = function Order() {

/**
Expand Down Expand Up @@ -207,6 +178,27 @@ var StatusEnum = {
return JSON.stringify(this);
}

var StatusEnum = {

/**
* @const
*/
PLACED: "placed",

/**
* @const
*/
APPROVED: "approved",

/**
* @const
*/
DELIVERED: "delivered"
};

Order.StatusEnum = StatusEnum;


if (module) {
module.Order = Order;
}
Expand Down
50 changes: 21 additions & 29 deletions samples/client/petstore/javascript/src/model/Pet.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,37 +14,8 @@
}
}(this, function(module, ApiClient, Category, Tag) {
'use strict';



//export module
if ( typeof define === "function" && define.amd ) {
define('StatusEnum', [], function() {
return StatusEnum;
});
}

var StatusEnum = {

/**
* @const
*/
AVAILABLE: "available",

/**
* @const
*/
PENDING: "pending",

/**
* @const
*/
SOLD: "sold"

}



var Pet = function Pet(photoUrls, name) {

/**
Expand Down Expand Up @@ -209,6 +180,27 @@ var StatusEnum = {
return JSON.stringify(this);
}

var StatusEnum = {

/**
* @const
*/
AVAILABLE: "available",

/**
* @const
*/
PENDING: "pending",

/**
* @const
*/
SOLD: "sold"
};

Pet.StatusEnum = StatusEnum;


if (module) {
module.Pet = Pet;
}
Expand Down
Loading