moxa-isd / oapi-doc Goto Github PK
View Code? Open in Web Editor NEWThingsPro OAPI document
License: MIT License
ThingsPro OAPI document
License: MIT License
這是我的提案
{
"tenantId": "65af94c4-07e4-43d7-abad-3cb5f295550b",
"uuid": "4b4f1ab2-18ac-483e-aedd-2aaeb2dabd59",
"group": "MOXA-ISD",
"modal": "Modal-1",
"type": "IIoT Gateway",
"status": "online",
"firmwareVersion": "1.0.0",
"configVersion": "1.0.0",
"reportedProperties": [
{
"id": 1,
"type": "systemTime",
"name": "date",
"description": "xxxx",
"value": ""
},
{
"id": 2,
"type": "systemTime",
"name": "timeZone",
"description": "xxxx",
"value": ""
},
{
"id": 3,
"type": "systemTime",
"name": "ntpEnable",
"description": "xxxx",
"value": ""
},
{
"id": 4,
"type": "systemTime",
"name": "timeServer",
"description": "xxxx",
"value": ""
},
{
"id": 5,
"type": "systemTime",
"name": "poolInterval",
"description": "xxxx",
"value": ""
},
{
"id": 6,
"type": "systemTime",
"name": "poolInterval",
"description": "xxxx",
"value": ""
},
{
"id": 7,
"type": "network",
"name": "eth0",
"description": "xxxx",
"value": [
{
"id": 1,
"name": "ipAddress",
"description": "xxxx",
"value": "192.168.3.21"
},
{
"id": 2,
"name": "mask",
"description": "xxxx",
"value": "255.255.255.0"
},
{
"id": 3,
"name": "gateway",
"description": "xxxx",
"value": "192.168.3.254"
},
{
"id": 4,
"name": "dhcp",
"description": "xxxx",
"value": true
},
{
"id": 5,
"name": "primaryDns",
"description": "xxxx",
"value": "192.168.3.254"
},
{
"id": 6,
"name": "secondaryDns",
"description": "xxxx",
"vaule": "10.29.11.121"
}
]
},
{
"id": 7,
"type": "location",
"name": "gps",
"description": "xxxx",
"value": [
{
"id": 1,
"name": "manualLatitude",
"description": "xxxx",
"value": 24.5533998
},
{
"id": 2,
"name": "manualLongitude",
"description": "xxxx",
"value": 122.4488993
}
]
},
{
"id": 8,
"type": "location",
"name": "system",
"description": "xxxx",
"value": "WGS-84/GCJ-02"
},
{
"id": 9,
"type": "connection",
"name": "status",
"description": "xxxx",
"value": "online"
},
{
"id": 10,
"type": "general",
"name": "deviceName",
"description": "xxxx",
"value": "My Name"
},
{
"id": 11,
"type": "general",
"name": "firmwareVersion",
"description": "xxxx",
"value": "1.0.0"
},
{
"id": 12,
"type": "general",
"name": "edgeVersion",
"description": "xxxx",
"value": "1.0.0"
},
{
"id": 13,
"type": "general",
"name": "configVersion",
"description": "xxxx",
"value": "1.0.0"
}
],
"desiredProperties": [
{
"id": 1,
"type": "systemTime",
"name": "date",
"description": "xxxx",
"value": ""
},
{
"id": 2,
"type": "systemTime",
"name": "timeZone",
"description": "xxxx",
"value": ""
},
{
"id": 3,
"type": "systemTime",
"name": "ntpEnable",
"description": "xxxx",
"value": ""
},
{
"id": 4,
"type": "systemTime",
"name": "timeServer",
"description": "xxxx",
"value": ""
},
{
"id": 5,
"type": "systemTime",
"name": "poolInterval",
"description": "xxxx",
"value": ""
},
{
"id": 6,
"type": "systemTime",
"name": "poolInterval",
"description": "xxxx",
"value": ""
},
{
"id": 7,
"type": "network",
"name": "eth0",
"description": "xxxx",
"value": [
{
"id": 1,
"name": "ipAddress",
"description": "xxxx",
"value": "192.168.3.21"
},
{
"id": 2,
"name": "mask",
"description": "xxxx",
"value": "255.255.255.0"
},
{
"id": 3,
"name": "gateway",
"description": "xxxx",
"value": "192.168.3.254"
},
{
"id": 4,
"name": "dhcp",
"description": "xxxx",
"value": true
},
{
"id": 5,
"name": "primaryDns",
"description": "xxxx",
"value": "192.168.3.254"
},
{
"id": 6,
"name": "secondaryDns",
"description": "xxxx",
"vaule": "10.29.11.121"
}
]
},
{
"id": 7,
"type": "location",
"name": "gps",
"description": "xxxx",
"value": [
{
"id": 1,
"name": "manualLatitude",
"description": "xxxx",
"value": 24.5533998
},
{
"id": 2,
"name": "manualLongitude",
"description": "xxxx",
"value": 122.4488993
}
]
},
{
"id": 8,
"type": "location",
"name": "system",
"description": "xxxx",
"value": "WGS-84/GCJ-02"
},
{
"id": 9,
"type": "connection",
"name": "status",
"description": "xxxx",
"value": "online"
},
{
"id": 10,
"type": "general",
"name": "deviceName",
"description": "xxxx",
"value": "My Name"
},
{
"id": 11,
"type": "general",
"name": "firmwareVersion",
"description": "xxxx",
"value": "1.0.0"
},
{
"id": 12,
"type": "general",
"name": "edgeVersion",
"description": "xxxx",
"value": "1.0.0"
},
{
"id": 13,
"type": "general",
"name": "configVersion",
"description": "xxxx",
"value": "1.0.0"
}
],
"reportedLastUpdatedAt": "2018-08-12T20:17:46.384Z",
"desiredLastUpdatedAt": "2018-08-12T20:17:46.384Z",
"createdAt": "2018-08-12T20:17:46.384Z",
"updatedAt": "2018-08-12T20:17:46.384Z"
}
Swagger schema validation failed.
Data does not match any schemas from 'oneOf' at #/paths//system/properties/{key}/get/responses/200
Additional properties not allowed: example at #/paths//system/properties/{key}/get/responses/200
Missing required property: $ref at #/paths//system/properties/{key}/get/responses/200
Look into the swagger file, /system/properties/{key}/get
will return a response of the union of gps
and aliasName
. However, the error told us data does not match any schema from oneOf
.
According to swagger document, to validate an union payload from multi schemas, we should use allOf
in definition of schemas where an example shown as below
components:
schemas:
Pet:
type: object
required:
- pet_type
properties:
pet_type:
type: string
discriminator:
propertyName: pet_type
Dog: # "Dog" is a value for the pet_type property (the discriminator value)
allOf: # Combines the main `Pet` schema with `Dog`-specific properties
- $ref: '#/components/schemas/Pet'
- type: object
# all other properties specific to a `Dog`
properties:
bark:
type: boolean
breed:
type: string
enum: [Dingo, Husky, Retriever, Shepherd]
Cat: # "Cat" is a value for the pet_type property (the discriminator value)
allOf: # Combines the main `Pet` schema with `Cat`-specific properties
- $ref: '#/components/schemas/Pet'
- type: object
# all other properties specific to a `Cat`
properties:
hunts:
type: boolean
age:
type: integer
but in oapi-tp-gateway/schema/system/index.yaml
.
'/system/properties/{key}':
parameters:
- name: key
in: path
type: string
required: true
get:
description: Get specific system property
responses:
'200':
description: success
schema:
allOf:
- '$ref': '#/definitions/SystemProperties/properties/aliasName'
- '$ref': '#/definitions/SystemProperties/properties/gps'
example:
application/json:
lat: 121.123
lng: 22.456
{
"deviceUUID": "7dc73055-2ad9-4fdc-96d6-c9d18582ce01",
"dataSource": "systemTag",
"messageTimeStamp": "2018-08-29T01:52:45.6888512Z",
"cpuUsage": {
"unit": "%",
"latest": {
"value": 10,
"updateTimeStamp": "2018-08-21T00:07:43.888Z"
},
"values": [
{ "value": 10, "updateTimeStamp": "2018-08-21T00:07:43.888Z" },
{ "value": 12, "updateTimeStamp": "2018-08-21T00:07:22.888Z" },
{ "value": 8, "updateTimeStamp": "2018-08-21T00:07:18.888Z" },
{ "value": 35, "updateTimeStamp": "2018-08-21T00:07:56.888Z" }
]
},
"memoryUsage": {
"unit": "%",
"total": 1000,
"latest": {
"value": 8,
"updateTimeStamp": "2018-08-21T00:07:43.888Z"
},
"values": [
{ "value": 8, "updateTimeStamp": "2018-08-21T00:07:18.888Z" },
{ "value": 35, "updateTimeStamp": "2018-08-21T00:07:56.888Z" }
]
},
"gps": {
"latitude": {
"unit": "",
"latest": {
"value": 8,
"updateTimeStamp": "2018-08-21T00:07:43.888Z"
},
"values": [
{ "value": 8, "updateTimeStamp": "2018-08-21T00:07:18.888Z" },
{ "value": 35, "updateTimeStamp": "2018-08-21T00:07:56.888Z" }
]
},
"longitude": {
"unit": "",
"latest": {
"value": 8,
"updateTimeStamp": "2018-08-21T00:07:43.888Z"
},
"values": [
{ "value": 8, "updateTimeStamp": "2018-08-21T00:07:18.888Z" },
{ "value": 35, "updateTimeStamp": "2018-08-21T00:07:56.888Z" }
]
}
},
"wifi": [
{
"id": 1,
"name": "wwan0",
"signal": {
"unit": "dB",
"latest": {
"value": 8,
"updateTimeStamp": "2018-08-21T00:07:43.888Z"
},
"values": [
{ "value": 8, "updateTimeStamp": "2018-08-21T00:07:18.888Z" },
{ "value": 35, "updateTimeStamp": "2018-08-21T00:07:56.888Z" }
]
},
"enable": {
"latest": {
"value": true,
"updateTimeStamp": "2018-08-21T00:07:43.888Z"
},
"values": [
{ "value": true, "updateTimeStamp": "2018-08-21T00:07:18.888Z" },
{ "value": true, "updateTimeStamp": "2018-08-21T00:07:56.888Z" }
]
}
}
],
"cellular": [
{
"id": 1,
"name": "cellular0",
"signal": {
"unit": "dB",
"latest": {
"value": 8,
"updateTimeStamp": "2018-08-21T00:07:43.888Z"
},
"values": [
{ "value": 8, "updateTimeStamp": "2018-08-21T00:07:18.888Z" },
{ "value": 35, "updateTimeStamp": "2018-08-21T00:07:56.888Z" }
]
},
"enable": {
"latest": {
"value": true,
"updateTimeStamp": "2018-08-21T00:07:43.888Z"
},
"values": [
{ "value": true, "updateTimeStamp": "2018-08-21T00:07:18.888Z" },
{ "value": true, "updateTimeStamp": "2018-08-21T00:07:56.888Z" }
]
}
}
],
"ethernet": [
{
"id": 1,
"name": "eth0",
"enable": {
"latest": {
"value": true,
"updateTimeStamp": "2018-08-21T00:07:43.888Z"
},
"values": [
{ "value": true, "updateTimeStamp": "2018-08-21T00:07:18.888Z" },
{ "value": false, "updateTimeStamp": "2018-08-21T00:07:56.888Z" }
]
}
}
],
"storageUsage": [
{
"id": 1,
"name": "storage0",
"size": {
"unit": "MB",
"total": 1000,
"latest": {
"value": 8,
"updateTimeStamp": "2018-08-21T00:07:43.888Z"
},
"values": [
{ "value": 8, "updateTimeStamp": "2018-08-21T00:07:18.888Z" },
{ "value": 35, "updateTimeStamp": "2018-08-21T00:07:56.888Z" }
]
}
}
]
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.