Help me to create swagger json file for below request.
{
"data": {
"app": {
"version": "1.0.0",
"name": "samco",
"channel": "androidmarket",
"build": "android-phone"
},
"hardware": {
"keyboard": "QWERTY",
"screen": "320 X 240",
"model": "BlackBerry Curve 9220",
"imei": "011234587362135",
"display": "Touch Sensitive Optical Trackpad",
"vendor": "RIM"
}
}
}
Tried to write below file. unable to get nested object.
{
"swagger": "2.0",
"info": {
"version": "1.0.0",
"title": "Swagger Petstore",
"contact": {
},
"license": {
"name": "Apache 2.0",
}
},
"host": "xxxxxxx",
"basePath": "/xxxxxxxxx",
"tags": [
{
"name": "2FA Login",
"description": "How to login using xxxxxxxs",
"externalDocs": {
"description": "Find out more",
"url": "--------"
}
}
],
"schemes": [
"http",
"https"
],
"paths": {
"/Logout/EndSession/1.0.0": {
"post": {
"tags": [
"EndSession"
],
"summary": "User Logout service",
"description": "Logout",
"operationId": "LogoutOperation",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"parameters": [
{
"in": "body",
"name": "body",
"description": "Request object",
"required": true,
"schema": {
"$ref": "#/definitions/data"
}
}
],
"responses": {
"200": {
"description": "Logout response"
}
}
}
}
},
"definitions": {
"app_data": {
"type": "object",
"required": [
"version",
"name",
"channel",
"build"
],
"properties": {
"version": {
"type": "string",
"example": "1.0.0"
},
"name": {
"type": "string",
"example": "asddd"
},
"channel": {
"type": "string",
"example": "androidmarket"
},
"build": {
"type": "string",
"example": "android-phone"
}
}
},
"hardware_data": {
"type": "object",
"required": [
"keyboard",
"screen",
"model",
"imei",
"display",
"vendor"
],
"properties": {
"keyboard": {
"type": "string",
"example": "QWERTY"
},
"screen": {
"type": "string",
"example": "320 X 240"
},
"model": {
"type": "string",
"example": "BlackBerry Curve 9220"
},
"imei": {
"type": "string",
"example": "011234587362135"
},
"display": {
"type": "string",
"example": "Touch Sensitive Optical Trackpad"
},
"vendor": {
"type": "string",
"example": "RIM"
}
}
},
"data": {
"type": "object",
"required": [
"hardware",
"app"
],
"properties": {
"type": "object",
"hardware": {
"type": "object",
"$ref": "#/definitions/hardware_data"
},
"app": {
"type": "object",
"$ref": "#/definitions/app_data"
}
}
}
}
}