forked from loafle/openapi-generator-original
Improved ExampleGenerator (#4797)
* Improved ExampleGenerator: - Now takes into account enum and uri/url formats for strings. - Uses example for referenced objects if available. - Proper examples get generated for specific numeric formats, because more specific formats now get checked before generic format. - Honors min and max values for numerical properties, if set. * Ran script `bin/nodejs-petstore-server.sh`. * Renamed log to logger to conform to coding standard.
This commit is contained in:
@@ -20,7 +20,7 @@ exports.getInventory = function(args, res, next) {
|
||||
**/
|
||||
var examples = {};
|
||||
examples['application/json'] = {
|
||||
"key" : 123
|
||||
"key" : 0
|
||||
};
|
||||
if (Object.keys(examples).length > 0) {
|
||||
res.setHeader('Content-Type', 'application/json');
|
||||
@@ -40,12 +40,12 @@ exports.getOrderById = function(args, res, next) {
|
||||
**/
|
||||
var examples = {};
|
||||
examples['application/json'] = {
|
||||
"id" : 123456789,
|
||||
"petId" : 123456789,
|
||||
"complete" : true,
|
||||
"status" : "aeiou",
|
||||
"quantity" : 123,
|
||||
"shipDate" : "2000-01-23T04:56:07.000+00:00"
|
||||
"petId" : 2,
|
||||
"quantity" : 9,
|
||||
"id" : 5,
|
||||
"shipDate" : "2000-01-23T04:56:07.000+00:00",
|
||||
"complete" : false,
|
||||
"status" : "placed"
|
||||
};
|
||||
if (Object.keys(examples).length > 0) {
|
||||
res.setHeader('Content-Type', 'application/json');
|
||||
@@ -65,12 +65,12 @@ exports.placeOrder = function(args, res, next) {
|
||||
**/
|
||||
var examples = {};
|
||||
examples['application/json'] = {
|
||||
"id" : 123456789,
|
||||
"petId" : 123456789,
|
||||
"complete" : true,
|
||||
"status" : "aeiou",
|
||||
"quantity" : 123,
|
||||
"shipDate" : "2000-01-23T04:56:07.000+00:00"
|
||||
"petId" : 5,
|
||||
"quantity" : 5,
|
||||
"id" : 1,
|
||||
"shipDate" : "2000-01-23T04:56:07.000+00:00",
|
||||
"complete" : false,
|
||||
"status" : "placed"
|
||||
};
|
||||
if (Object.keys(examples).length > 0) {
|
||||
res.setHeader('Content-Type', 'application/json');
|
||||
|
||||
Reference in New Issue
Block a user