Skip to content

Instantly share code, notes, and snippets.

@har07
Created June 4, 2020 06:17
Show Gist options
  • Save har07/729fabb9c18d6ae7c3a10efcebeca5dd to your computer and use it in GitHub Desktop.
Save har07/729fabb9c18d6ae7c3a10efcebeca5dd to your computer and use it in GitHub Desktop.
JS Bin // source https://jsbin.com/wawayuj
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
var swagger = {
"definitions": {
"redisv10About_Us__GetRequest": {
"type": "object",
"properties": {
"age": {
"type": "number",
"format": "double"
},
"yos": {
"type": "number",
"format": "double"
}
}
},
"redisv10AddCompanyRequest": {
"type": "object",
"properties": {
"companies": {
"type": "array",
"items": {
"$ref": "#/definitions/redisv10AddCompanyItemRequest"
}
}
}
},
"redisv10AddCompanyItemRequest": {
"type": "object",
"properties": {
"company_code": {
"type": "string"
},
"company_name": {
"type": "string"
}
}
},
"redisv10AddProfileRequest": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"mother": {
"type": "object",
"properties": {
"name": "string"
}
}
}
}
}
};
var test_cases = [{
"Type": "API",
"TestObjDesc": "API - About Us - Get",
"input_message": {
"age": 30,
"yos": 5
}
}, {
"Type": "API",
"TestObjDesc": "API - AddCompany",
"input_message": {
"companies": [{
"company_code": "CF81",
"company_name": "PT Chevron Indonesia"
}]
}
}, {
"Type": "API",
"TestObjDesc": "API - AddProfile",
"input_message": {
"name": "Andrew",
"mother": {
"name": "Julia"
}
}
}];
// TODO: implement the following logic
// for each test case:
// - find request body definition in swagger that match current test endpoint/api method
// - terlusuri semua field di dalam json test case input_message. utk setiap field:
// - jika array: telusuri field di items definition nya (rekursif)
// - jika object: telusuri field di properties definition nya (rekursif)
// - jika tipe data field nya primitif type: cari property yg match di swagger definition dan tambahkan example
</script>
<script id="jsbin-source-javascript" type="text/javascript">var swagger = {
"definitions": {
"redisv10About_Us__GetRequest": {
"type": "object",
"properties": {
"age": {
"type": "number",
"format": "double"
},
"yos": {
"type": "number",
"format": "double"
}
}
},
"redisv10AddCompanyRequest": {
"type": "object",
"properties": {
"companies": {
"type": "array",
"items": {
"$ref": "#/definitions/redisv10AddCompanyItemRequest"
}
}
}
},
"redisv10AddCompanyItemRequest": {
"type": "object",
"properties": {
"company_code": {
"type": "string"
},
"company_name": {
"type": "string"
}
}
},
"redisv10AddProfileRequest": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"mother": {
"type": "object",
"properties": {
"name": "string"
}
}
}
}
}
};
var test_cases = [{
"Type": "API",
"TestObjDesc": "API - About Us - Get",
"input_message": {
"age": 30,
"yos": 5
}
}, {
"Type": "API",
"TestObjDesc": "API - AddCompany",
"input_message": {
"companies": [{
"company_code": "CF81",
"company_name": "PT Chevron Indonesia"
}]
}
}, {
"Type": "API",
"TestObjDesc": "API - AddProfile",
"input_message": {
"name": "Andrew",
"mother": {
"name": "Julia"
}
}
}];
// TODO: implement the following logic
// for each test case:
// - find request body definition in swagger that match current test endpoint/api method
// - terlusuri semua field di dalam json test case input_message. utk setiap field:
// - jika array: telusuri field di items definition nya (rekursif)
// - jika object: telusuri field di properties definition nya (rekursif)
// - jika tipe data field nya primitif type: cari property yg match di swagger definition dan tambahkan example
</script></body>
</html>
var swagger = {
"definitions": {
"redisv10About_Us__GetRequest": {
"type": "object",
"properties": {
"age": {
"type": "number",
"format": "double"
},
"yos": {
"type": "number",
"format": "double"
}
}
},
"redisv10AddCompanyRequest": {
"type": "object",
"properties": {
"companies": {
"type": "array",
"items": {
"$ref": "#/definitions/redisv10AddCompanyItemRequest"
}
}
}
},
"redisv10AddCompanyItemRequest": {
"type": "object",
"properties": {
"company_code": {
"type": "string"
},
"company_name": {
"type": "string"
}
}
},
"redisv10AddProfileRequest": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"mother": {
"type": "object",
"properties": {
"name": "string"
}
}
}
}
}
};
var test_cases = [{
"Type": "API",
"TestObjDesc": "API - About Us - Get",
"input_message": {
"age": 30,
"yos": 5
}
}, {
"Type": "API",
"TestObjDesc": "API - AddCompany",
"input_message": {
"companies": [{
"company_code": "CF81",
"company_name": "PT Chevron Indonesia"
}]
}
}, {
"Type": "API",
"TestObjDesc": "API - AddProfile",
"input_message": {
"name": "Andrew",
"mother": {
"name": "Julia"
}
}
}];
// TODO: implement the following logic
// for each test case:
// - find request body definition in swagger that match current test endpoint/api method
// - terlusuri semua field di dalam json test case input_message. utk setiap field:
// - jika array: telusuri field di items definition nya (rekursif)
// - jika object: telusuri field di properties definition nya (rekursif)
// - jika tipe data field nya primitif type: cari property yg match di swagger definition dan tambahkan example
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment