diff --git a/DISCLAIMER.md b/DISCLAIMER.md new file mode 100644 index 0000000..4e81410 --- /dev/null +++ b/DISCLAIMER.md @@ -0,0 +1 @@ +THIS SOFTWARE IS PROVIDED BY THE OPEN CONNECTIVITY FOUNDATION, INC. "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE OR WARRANTIES OF NON-INFRINGEMENT, ARE DISCLAIMED. IN NO EVENT SHALL THE OPEN CONNECTIVITY FOUNDATION, INC. OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..0e4811b --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,3 @@ +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: +1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. diff --git a/oic.collection-schema.json b/oic.collection-schema.json new file mode 100644 index 0000000..e6d5aa7 --- /dev/null +++ b/oic.collection-schema.json @@ -0,0 +1,64 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "description" : "Copyright (c) 2016 Open Connectivity Foundation, Inc. All rights reserved.", + "id": "https://www.openconnectivity.org/ocf-apis/core/schemas/oic.collection-schema.json#", + "title": "Collection", + "definitions": { + "oic.collection.setoflinks": { + "description": "A set (array) of simple or individual OIC Links. In addition to properties required for an OIC Link, the identifier for that link in this set is also required", + "type": "array", + "items": { + "$ref": "oic.oic-link-schema.json#/definitions/oic.oic-link" + } + }, + "oic.collection.alllinks": { + "description": "All forms of links in a collection", + "$ref": "#/definitions/oic.collection.setoflinks" + }, + "oic.collection": { + "type": "object", + "description": "A collection is a set (array) of tagged-link or set (array) of simple links along with additional properties to describe the collection itself", + "properties": { + "n": { + "type": "string", + "description": "User friendly name of the collection" }, + "id": { + "anyOf": [ + { + "type": "integer", + "description": "A number that is unique to that collection; like an ordinal number that is not repeated" + }, + { + "type": "string", + "description": "A unique string that could be a hash or similarly unique" + }, + { + "$ref": "oic.types-schema.json#/definitions/uuid", + "description": "A unique string that could be a UUIDv4" + } + ], + "description": "ID for the collection. Can be an value that is unique to the use context or a UUIDv4" + }, + "di": { + "$ref": "oic.types-schema.json#/definitions/uuid", + "description": "The device ID which is an UUIDv4 string; used for backward compatibility with Spec A definition of /oic/res" + }, + "rts": { + "$ref": "oic.core-schema.json#/definitions/oic.core/properties/rt", + "description": "Defines the list of allowable resource types (for Target and anchors) in links included in the collection; new links being created can only be from this list" }, + "drel": { + "type": "string", + "description": "When specified this is the default relationship to use when an OIC Link does not specify an explicit relationship with *rel* parameter" + }, + "links": { + "$ref": "#/definitions/oic.collection.alllinks" + } + } + } + }, + "type": "object", + "allOf": [ + {"$ref": "oic.core-schema.json#/definitions/oic.core"}, + {"$ref": "#/definitions/oic.collection"} + ] +} diff --git a/oic.oic-link-schema.json b/oic.oic-link-schema.json new file mode 100644 index 0000000..c3e5f59 --- /dev/null +++ b/oic.oic-link-schema.json @@ -0,0 +1,148 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "description" : "Copyright (c) 2016 Open Connectivity Foundation, Inc. All rights reserved.", + "id": "https://www.openconnectivity.org/ocf-apis/core/schemas/oic.oic-link-schema.json#", + "definitions": { + "oic.oic-link": { + "type": "object", + "properties": { + "href": { + "type": "string", + "maxLength": 256, + "description": "This is the target URI, it can be specified as a Relative Reference or fully-qualified URI. Relative Reference should be used along with the di parameter to make it unique.", + "format": "uri" + }, + "rel": { + "oneOf":[ + { + "type": "array", + "items": [ + { + "type": "string", + "maxLength": 64 + } + ], + "minItems": 1, + "default": ["hosts"] + }, + { + "type": "string", + "maxLength": 64, + "default": "hosts" + } + ], + "description": "The relation of the target URI referenced by the link to the context URI" + }, + "rt": { + "type": "array", + "items" : [ + { + "type" : "string", + "maxLength": 64 + } + ], + "minItems" : 1, + "readOnly": true, + "description": "Resource Type" + }, + "if": { + "type": "array", + "items": [ + { + "type" : "string", + "enum" : ["oic.if.baseline", "oic.if.ll", "oic.if.b", "oic.if.rw", "oic.if.r", "oic.if.a", "oic.if.s" ] + } + ], + "minItems": 1, + "readOnly": true, + "description": "The interface set supported by this resource" + }, + "di": { + "$ref": "oic.types-schema.json#/definitions/uuid", + "description": "Unique identifier for device (UUID)" + }, + "buri": { + "type": "string", + "description": "The base URI used to fully qualify a Relative Reference in the href parameter. Use the OCF Schema for URI", + "maxLength": 256, + "format": "uri" + }, + "p": { + "readOnly": true, + "description": "Specifies the framework policies on the Resource referenced by the target URI", + "type": "object", + "properties": { + "bm": { + "readOnly": true, + "description": "Specifies the framework policies on the Resource referenced by the target URI for e.g. observable and discoverable", + "type": "integer" + }, + "sec": { + "readOnly": true, + "description": "Specifies if security needs to be turned on when looking to interact with the Resource", + "default": false, + "type": "boolean" + }, + "port": { + "readOnly": true, + "description": "Secure port to be used for connection", + "type": "integer" + } + }, + "required" : ["bm"] + }, + "bp": { + "type": "string", + "description": " Batch Parameters: URI parameters to use with an oic.if.b batch request using this link" + }, + "title": { + "type": "string", + "maxLength": 64, + "description": "A title for the link relation. Can be used by the UI to provide a context" + }, + "anchor": { + "type": "string", + "maxLength": 256, + "description": "This is used to override the context URI e.g. override the URI of the containing collection", + "format": "uri" + }, + "ins": { + "oneOf": [ + { + "type": "integer", + "description": "An ordinal number that is not repeated - must be unique in the collection context" + }, + { + "type": "string", + "maxLength": 256, + "format" : "uri", + "description": "Any unique string including a URI" + }, + { + "$ref": "oic.types-schema.json#/definitions/uuid", + "description": "Unique identifier (UUID)" + } + ], + "description": "The instance identifier for this web link in an array of web links - used in collections" + }, + "type": { + "type": "array", + "description": "A hint at the representation of the resource referenced by the target URI. This represents the media types that are used for both accepting and emitting", + "items" : [ + { + "type": "string", + "maxLength": 64 + } + ], + "minItems": 1, + "default": "application/cbor" + } + }, + "required": [ "href", "rt", "if" ] + } + }, + "type": "object", + "allOf": [ + { "$ref": "#/definitions/oic.oic-link" } + ] +} diff --git a/oic.wk.col.raml b/oic.wk.col.raml new file mode 100644 index 0000000..ceb4837 --- /dev/null +++ b/oic.wk.col.raml @@ -0,0 +1,251 @@ +#%RAML 0.8 +#RAML for OIC Collections. +# This is an initial version; has to be converted to a RAML resource type so that it can be used when defining resource that +# are collections. Also needs to use traits to have the same query parameters recognized for all the methods. +title: Collections +version: 1.0 +documentation: + + - title: OIC Collections + content: | + Collection is an extensions of OIC Resource concept. + In addition to properties, collections also have an + array of OIC web links. + + - title: Introduction + content: | + Collections can be used to group sets of resources, + build structures like topologies, to define a + dependency relationship etc + + - title: Resource Design + content: | + The collection resource is specified as three Base URIs, one + for each interface which is supported by the collection, in addition + to the resource interfaces e.g. oic.if.s, oic.if.rw + + THese three URIs are typically the same URI path, only distinguished + by the different query parameter traits + +schemas: + - sbaseline: !include schemas/oic.collection-schema.json + - sbatch-retrieve: !include schemas/oic.collection.batch-retrieve-schema.json + - sbatch-update: !include schemas/oic.collection.batch-update-schema.json + - slinks: !include schemas/oic.collection.linkslist-schema.json + +traits: + - interface-baseline: + queryParameters: + if: + enum: ["oic.if.baseline"] + + - interface-b: + queryParameters: + if: + enum: ["oic.if.b"] + + - interface-ll: + queryParameters: + if: + enum: ["oic.if.ll"] + + +/CollectionBaselineInterfaceURI: + description: | + OCF Collection Resource Type contains properties and links. + The oic.if.baseline interface exposes a representation of + the links and the properties of the collection resource itself + + + displayName: OCF Collection + is: [ interface-baseline ] + + get: + description: | + Retrieve on Baseline Interface + + responses: + 200: + body: + application/json: + schema: sbaseline + example: | + { + "rt": ["oic.wk.col"], + "id": "unique_example_id", + "rts": [ "oic.r.switch.binary", "oic.r.airflow" ], + "links": [ + { + "href": "switch", + "rt": ["oic.r.switch.binary"], + "if": ["oic.if.a", "oic.if.baseline"] + }, + { + "href": "airFlow", + "rt": ["oic.r.airflow"], + "if": ["oic.if.a", "oic.if.baseline"] + } + ] + } + + + post: + description: | + Update on Baseline Interface + + body: + application/json: + schema: sbaseline + + responses: + 200: + body: + application/json: + schema: sbaseline + + +/CollectionBatchInterfaceURI: + description: | + OCF Collection Resource Type contains properties and links. + The oic.if.b interfacce exposes a composite representation of the + resources pointed to by the links + + displayName: Batch Representation of an OCF COllection + is: [ interface-b ] + + get: + description: | + Retrieve on Batch Interface + + responses: + 200: + description: "All targets returned OK status (HTTP 200 or CoAP 2.05 Content)" + body: + application/json: + schema: sbatch-retrieve + example: | + [ + { + "href": "switch", + "rep": + { + "value": true + } + }, + { + "href": "airFlow", + "rep": + { + "direction": "floor", + "speed": 3 + } + } + ] + 404: + description: "One or more targets did not return an OK status, return a representation containing returned properties from the targets that returned OK" + body: + application/json: + schema: sbatch-retrieve + example: | + [ + { + "href": "switch", + "rep": + { + "value": true + } + } + ] + + post: + description: | + Update on Batch Interface + + body: + application/json: + schema: sbatch-update + example: | + { + "direction": "demist", + "speed": 5 + } + + responses: + 200: + description: "all targets returned OK status (HTTP 200 or CoAP 2.04 Changed) return a representation of the current state of all targets" + body: + application/json: + schema: sbatch-retrieve + example: | + [ + { + "href": "switch", + "rep": + { + "value": true + } + }, + { + "href": "airFlow", + "rep": + { + "direction": "demist", + "speed": 5 + } + } + ] + + 403: + description: "one or more targets did not return OK status; return a retrieve representation of the current state of all targets in the batch" + body: + application/json: + schema: sbatch-retrieve + example: | + [ + { + "href": "switch", + "rep": + { + "value": true + } + }, + { + "href": "airFlow", + "rep": + { + "direction": "floor", + "speed": 3 + } + } + ] + +/CollectionLinkListInterfaceURI: + description: | + OCF Collection Resource Type contains properties and links. + The oic.if.ll interface exposes a representation of the links + + displayName: Batch Representation of an OCF Collection + is: [ interface-ll ] + + get: + description: | + Retrieve on Link List Interface + + responses: + 200: + body: + application/json: + schema: slinks + example: | + [ + { + "href": "switch", + "rt": ["oic.r.switch.binary"], + "if": ["oic.if.a", "oic.if.baseline"] + }, + { + "href": "airFlow", + "rt": ["oic.r.airflow"], + "if": ["oic.if.a", "oic.if.baseline"] + } + ] diff --git a/oic.wk.con.raml b/oic.wk.con.raml new file mode 100755 index 0000000..2bc4537 --- /dev/null +++ b/oic.wk.con.raml @@ -0,0 +1,67 @@ +#%RAML 0.8 +title: OIC Configuration +version: v1-20160622 +documentation: + + - title: OCF Copyright + content: Copyright (c) 2016 Open Connectivity Foundation, Inc. All rights reserved. + - title: OCF License + content: !include LICENSE.md + - title: OCF Disclaimer + content: !include DISCLAIMER.md + + +schemas: + - Configuration: !include schemas/oic.wk.con-schema.json + + +traits: + - interface: + queryParameters: + if: + enum: ["oic.if.rw", "oic.if.baseline"] + +/oic/con: + displayName: OIC Configuration + is: [ interface ] + description: | + Known resource that is hosted by every Server. + Allows for device specific information to be configured. + + get: + description: | + Retrieves the current configuration settings + responses: + 200: + body: + application/json: + schema: Configuration + example: | + { + "rt": ["oic.wk.con"], + "n": "My Friendly Device Name", + "loc": "My Location Information", + "locn": "My Location Name", + "c": "USD", + "r": "MyRegion" + } + + post: + description: | + Update the information about the Device + body: + application/json: + schema: Configuration + example: | + { + "n": "My Friendly Device Name" + } + responses: + 200: + body: + application/json: + schema: Configuration + example: | + { + "n": "My Friendly Device Name" + } diff --git a/oic.wk.d.raml b/oic.wk.d.raml new file mode 100755 index 0000000..9e51e49 --- /dev/null +++ b/oic.wk.d.raml @@ -0,0 +1,43 @@ +#%RAML 0.8 +title: OIC Root Device +version: v1-20160622 +documentation: + + - title: OCF Copyright + content: Copyright (c) 2016 Open Connectivity Foundation, Inc. All rights reserved. + - title: OCF License + content: !include LICENSE.md + - title: OCF Disclaimer + content: !include DISCLAIMER.md + + +schemas: + - Device: !include schemas/oic.wk.d-schema.json +traits: + - interface: + queryParameters: + if: + enum: ["oic.if.r", "oic.if.baseline"] + +/oic/d: + displayName: Device + is: [ interface ] + description: | + Known resource that is hosted by every Server. + Allows for logical device specific information to be discovered. + get: + description: | + Retrieve the information about the Device + responses: + 200: + body: + application/json: + schema: Device + example: | + { + "n": "Device 1", + "rt": ["oic.wk.d"], + "di": "54919CA5-4101-4AE4-595B-353C51AA983C", + "icv": "core.1.1.0", + "dmv": "res.1.1.0" + } diff --git a/oic.wk.mnt.raml b/oic.wk.mnt.raml new file mode 100755 index 0000000..515043c --- /dev/null +++ b/oic.wk.mnt.raml @@ -0,0 +1,77 @@ +#%RAML 0.8 +title: Maintenance +version: v1-20160622 +documentation: + + - title: OCF Copyright + content: Copyright (c) 2016 Open Connectivity Foundation, Inc. All rights reserved. + - title: OCF License + content: !include LICENSE.md + - title: OCF Disclaimer + content: !include DISCLAIMER.md + + +schemas: + - MNT: !include schemas/oic.wk.mnt-schema.json +traits: + - interface: + queryParameters: + if: + enum: ["oic.if.r", "oic.if.baseline"] + +/oic/mnt: + displayName: Maintenance + is: [ interface ] + description: | + The resource through which an Device is maintained and can be used for diagnostic purposes. + fr (Factory Reset) is a boolean. + The value 0 means No action (Default), the value 1 means Start Factory Reset + After factory reset, this value shall be changed back to the default value + rb (Reboot) is a boolean. + The value 0 means No action (Default), the value 1 means Start Reboot + After Reboot, this value shall be changed back to the default value + + get: + description: Retrieve the maintenance action status + queryParameters: + if: + enum: ["oic.if.r"] + responses: + 200: + body: + application/json: + schema: MNT + example: | + { + "rt": ["oic.wk.mnt"], + "n": "My Maintenance Actions", + "fr": false, + "rb": false + } + + post: + description: | + Set the maintenance action(s) + queryParameters: + if: + enum: ["oic.if.rw"] + body: + application/json: + schema: MNT + example: | + { + "n": "My Maintenance Actions", + "fr": false, + "rb": false + } + responses: + 200: + body: + application/json: + schema: MNT + example: | + { + "n": "My Maintenance Actions", + "fr": false, + "rb": false + } diff --git a/oic.wk.p.raml b/oic.wk.p.raml new file mode 100755 index 0000000..7b1f09a --- /dev/null +++ b/oic.wk.p.raml @@ -0,0 +1,42 @@ +#%RAML 0.8 +title: Platform +version: v1-20160622 +documentation: + + - title: OCF Copyright + content: Copyright (c) 2016 Open Connectivity Foundation, Inc. All rights reserved. + - title: OCF License + content: !include LICENSE.md + - title: OCF Disclaimer + content: !include DISCLAIMER.md + + +schemas: + - Platform: !include schemas/oic.wk.p-schema.json +traits: + - interface: + queryParameters: + if: + enum: ["oic.if.r", "oic.if.baseline"] + +/oic/p: + displayName: Platform + is: [ interface ] + description: | + Known resource that is defines the platform on which an Server is hosted. + Allows for platform specific information to be discovered. + get: + description: | + Retrieve the information about the Platform + + responses: + 200: + body: + application/json: + schema: Platform + example: | + { + "pi": "54919CA5-4101-4AE4-595B-353C51AA983C", + "rt": ["oic.wk.p"], + "mnmn": "Acme, Inc" + } diff --git a/oic.wk.ping.raml b/oic.wk.ping.raml new file mode 100755 index 0000000..87bdc94 --- /dev/null +++ b/oic.wk.ping.raml @@ -0,0 +1,39 @@ +#%RAML 0.8 +title: Ping +version: v1-20160622 +documentation: + + - title: OCF Copyright + content: Copyright (c) 2016 Open Connectivity Foundation, Inc. All rights reserved. + - title: OCF License + content: !include LICENSE.md + - title: OCF Disclaimer + content: !include DISCLAIMER.md + + +schemas: + - PING: !include schemas/oic.wk.ping-schema.json +traits: + - interface: + queryParameters: + if: + enum: ["oic.if.rw", "oic.if.baseline"] + +/oic/ping: + displayName: Ping + is: [ interface ] + description: | + The resource using which an Client keeps its Connection with an Server active. + get: + description: Retrieve the ping information + responses: + 200: + body: + application/json: + schema: PING + example: | + { + "rt": ["oic.wk.ping"], + "n": "Ping Information", + "in": 16 + } diff --git a/oic.wk.res.raml b/oic.wk.res.raml new file mode 100755 index 0000000..8998d4d --- /dev/null +++ b/oic.wk.res.raml @@ -0,0 +1,58 @@ +#%RAML 0.8 +title: Discoverable Resources +version: v1-20160622 +documentation: + + - title: OCF Copyright + content: Copyright (c) 2016 Open Connectivity Foundation, Inc. All rights reserved. + - title: OCF License + content: !include LICENSE.md + - title: OCF Disclaimer + content: !include DISCLAIMER.md + + +schemas: + - Resources: !include schemas/oic.wk.res-schema.json + +traits: + - interface: + queryParameters: + if: + enum: ["oic.if.ll", "oic.if.baseline"] + +/oic/res: + displayName: Discoverable Resources + is: [ interface ] + description: | + The resource through which the corresponding Server is discovered and introspected for available resources. + get: + description: | + Retrieve the discoverable resource set + + responses: + 200: + body: + application/json: + schema: Resources + example: | + [ + { + "rt": ["oic.wk.res"], + "di": "0685B960-736F-46F7-BEC0-9E6CBD61ADC1", + "links": + [ + { + "href": "/res", + "rel": "self", + "rt": ["oic.r.collection"], + "if": ["oic.if.ll"] + }, + { + "href": "/smartDevice", + "rel": "contained", + "rt": ["oic.d.smartDevice"], + "if": ["oic.if.a"] + } + ] + } + ] diff --git a/rdpublish.raml b/rdpublish.raml new file mode 100755 index 0000000..8a7f346 --- /dev/null +++ b/rdpublish.raml @@ -0,0 +1,157 @@ +#%RAML 0.8 +#RAML for Resource Directory +title: Resource Directory +version: v1-20160622 +documentation: + + - title: OCF Copyright + content: Copyright (c) 2016 Open Connectivity Foundation, Inc. All rights reserved. + - title: OCF License + content: !include LICENSE.md + - title: OCF Disclaimer + content: !include DISCLAIMER.md + + - title: Resource Directory + content: | + A Resoure Directory is an Device that helps other Devices to be discovered. + - title: Introduction + content: | + For resource in other Devices to be discovered using the Resource Directory, these other devices have to publish the resource links they would otherwise have advertised through /oic/res to the Resource Directory. Once the information has been published then the Devices may stop responding to discovery queries and may also go to sleep. + + The Resource Directory will respond to all discovery queries with resources that it directly advertises and also the resource information that has been published to it. + - title: Resource Directory discovery + content: | + Before a Device publishes its resource information, it must first discover available Resource Directories and then select one of those to publish the information to. + + This doscovery is done with a multicast query to /oic/rd. The information returned is either a bais factor or a list of attributes that help the discovering Device to select one of the RDs. This RD will be used till the RD does not respond or another RD is selected. + - title: Resource Directory publish + content: | + Once the RD has been discovery and selected, the Device can publish its resoure information. The resource information are published to the /oic/rd resource using the "publish" interface. The information that needs to tbe available in /oic/res is then populated by the Resource Directory. + + Periodically based on the TTL set by the publishing Device, the information that is published has to be refreshed with a new TTL or the TTL can be updated if there is no change in the information. It is the responsibility of the publishing Device to ensure that the information or TTL is updated before the previous TTL expires; failing this the RD will garbage collect all the information related to the publishing Device. + - title: Resource discovery + content: | + The discovery of resources is done in the same manner as for any Server. A query to /oic/res either over multicast or uincast is required. + +schemas: + # Each schema represents an OIC Resource Type. The baseline interface operates on the entire representation +- rdPublish: !include schemas/oic.rd.publish-schema.json +- rdSelection: !include schemas/oic.rd.selection-schema.json + # rdDelLink: !include schemas/oic.rd.del-link-schema.json + +traits: +- rddefinterface: + queryParameters: + if: + description: | + Interface is optional since there is only one interface supported for the Resource Type + Both for RD selectin and for publish + type: string + enum: [ "oic.if.baseline" ] + default: "oic.if.baseline" + required: false + example: | + GET /oic/rd?if=oic.wk.baseline + +/oic/rd: + displayName: Resource directory resource + description: | + Resource to be exposed by any Device that can act as a Resource Directory + get: + description: | + Get the attributes of the Resource Directory for selection purposes. + queryParameters: + rt: + description: | + Only one Resource Type is used for GET; RT is optional + type: string + enum: [ "oic.wk.rd" ] + default: "oic.wk.rd" + required: false + example: | + GET /oic/rd?rt=oic.wk.rd + is: [ rddefinterface ] + responses: + 200: + description: | + Respond with the selector criteria - either the set of attributes or the bias factor + body: + application/json: + schema: rdSelection + example: | + { + "rt": "oic.wk.rd", + "sel": 50 + } + post: + description: | + Publish the resource information. Appropriates parts of the information posted will be discovered through /oic/res + body: + application/json: + schema: rdPublish + # Maybe the entire published information should be treated as a new resource - as if created using the link-batch interface. + queryParameters: + rt: + description: | + Only one Resource Type is used for GET; RT is optional + type: string + enum: [ "oic.wk.rdpub" ] + default: "oic.wk.rdpub" + required: false + example: | + GET /oic/rd?rt=oic.wk.rdpub + is: [ rddefinterface ] + responses: + 200: + description: | + Respond with the same schema as publish but with the links have the "ins" parameter set to the appropriate instance value. + This value is used by the receiver to manage that OIC Link instance. + body: + application/json: + schema: rdPublish + example: | + { + "links": [ + { + "href": "coap://someAuthority:1000/somePath", + "rt": "oic.r.someResource", + "if": "oic.if.a", + "ins": 12345 + }, + { + "href": "coap://someAuthority:1000/somePath", + "rt": "oic.r.someOtherResource", + "if": "oic.if.baseline", + "ins": 54321 + } + ], + "ttl": 600 + } + + delete: + description: | + Delete a particular OIC Link - the link may be a simple link or a link in a tagged set. + queryParameters: + di: + displayName: ID of the device making request + description: | + This is used to determine which set of links to operata on. (Need authentication to ensure that there is no spoofing). If instance is ommitted then the entire set of links from this device ID is deleted + type: string + required: true + example: | + DELETE /oic/rd?di="0685B960-736F-46F7-BEC0-9E6CBD671ADC1" + ins: + displayName: Link instance for deletion + description: | + Instance of the link to delete + Value of parameter is a string where instance to be deleted are comma separated + type: string + required: false + example: | + DELETE /oic/rd?di="0685B960-736F-46F7-BEC0-9E6CBD671ADC1";ins="20" + responses: + 200: + description: The delete succeeded + +# The discovery through the /oic/res of the resource directory is the same as the standard resource discovery +# Need to include the RAML for /oic/res based resource discovery diff --git a/scene.raml b/scene.raml new file mode 100755 index 0000000..f3fd284 --- /dev/null +++ b/scene.raml @@ -0,0 +1,150 @@ +#%RAML 0.8 +title: Scene +version: v1-20160622 +documentation: + + - title: OCF Copyright + content: Copyright (c) 2016 Open Connectivity Foundation, Inc. All rights reserved. + - title: OCF License + content: !include LICENSE.md + - title: OCF Disclaimer + content: !include DISCLAIMER.md + + +schemas: + - Collection: !include schemas/oic.collection-schema.json + - SceneCollection: !include schemas/oic.sceneCollection-schema.json + - SceneCollectionUpdate: !include schemas/oic.sceneCollection-Update-schema.json + - SceneMember: !include schemas/oic.sceneMember-schema.json + +traits: + - interface: + queryParameters: + if: + enum: ["oic.if.a", "oic.if.ll", "oic.if.baseline"] + + +/SceneListResURI: + description: | + Toplevel Scene resource. + This resource is a generic collection resource. + The rts value shall contain oic.sceneCollection resource types. + displayName: Scenes (Top level) + + get: + description: | + Provides the current list of web links pointing to scenes + responses: + 200: + body: + application/json: + schema: Collection + example: | + { + "rt": "oic.wk.sceneList", + "n": "list of scene Collections", + "rts": "oic.wk.sceneCollection", + "links": [ + ] + } + + + +/SceneCollectionResURI: + description: | + Collection that models a set of Scenes. + This resource is a generic collection resource with additional parameters. + The rts value shall contain oic.sceneMember resource types. + The additional parameters are + lastScene, this is the scene value last set by any OIC Client + sceneValueList, this is the list of available scenes + lastScene shall be listed in sceneValueList. + displayName: Scene Collections + + get: + description: | + Provides the current list of web links pointing to scenes + responses: + 200: + body: + application/json: + schema: SceneCollection + example: | + { + "lastScene": "off", + "sceneValues": "off,Reading,TVWatching", + "rt": "oic.wk.sceneCollection", + "n": "My Scenes for my living room", + "id": "0685B960-736F-46F7-BEC0-9E6CBD671ADC1", + "rts": "oic.wk.sceneMember", + "links": [ + ] + } + + put: + description: | + Provides the action to change the last settted scene selection. + Calling this method shall update of all sceneMembers to the prescribed membervalue. + When this method is called with the same value as the current lastScene value + then all sceneMembers shall be updated. + + body: + application/json: + schema: SceneCollectionUpdate + example: | + { + "lastScene": "Reading" + } + + responses: + 200: + description: | + Indicates that the value is changed. + The changed properties are provided in the response. + body: + application/json: + schema: SceneCollectionUpdate + example: | + { + "lastScene": "Reading" + } + + +/SceneMemberResURI: + description: | + Collection that models a sceneMember. + displayName: Scene Member + + get: + description: | + Provides the scene member + responses: + 200: + body: + application/json: + schema: SceneMember + example: | + { + "id": "0685B960-FFFF-46F7-BEC0-9E6234671ADC1", + "n": "my binary switch (for light bulb) mappings", + "link": { "href":"coap://mydevice/mybinaryswitch", + "if": "oic.if.a", + "rt": "oic.r.switch.binary" }, + "sceneMappings": [ + { + "scene": "off", + "memberProperty": "value", + "memberValue": true + }, + { + "scene": "Reading", + "memberProperty": "value", + "memberValue": false + }, + { + "scene": "TVWatching", + "memberProperty": "value", + "memberValue": true + } + ] + } diff --git a/schemas/DISCLAIMER.md b/schemas/DISCLAIMER.md new file mode 100644 index 0000000..4e81410 --- /dev/null +++ b/schemas/DISCLAIMER.md @@ -0,0 +1 @@ +THIS SOFTWARE IS PROVIDED BY THE OPEN CONNECTIVITY FOUNDATION, INC. "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE OR WARRANTIES OF NON-INFRINGEMENT, ARE DISCLAIMED. IN NO EVENT SHALL THE OPEN CONNECTIVITY FOUNDATION, INC. OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/schemas/LICENSE.md b/schemas/LICENSE.md new file mode 100644 index 0000000..0e4811b --- /dev/null +++ b/schemas/LICENSE.md @@ -0,0 +1,3 @@ +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: +1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. diff --git a/schemas/oic.collection-schema.json b/schemas/oic.collection-schema.json new file mode 100755 index 0000000..9f37c29 --- /dev/null +++ b/schemas/oic.collection-schema.json @@ -0,0 +1,68 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "description" : "Copyright (c) 2016 Open Connectivity Foundation, Inc. All rights reserved.", + "id": "https://www.openconnectivity.org/ocf-apis/core/schemas/oic.collection-schema.json#", + "title": "Collection", + "definitions": { + "oic.collection.setoflinks": { + "description": "A set (array) of simple or individual OIC Links. In addition to properties required for an OIC Link, the identifier for that link in this set is also required", + "type": "array", + "items": { + "$ref": "oic.oic-link-schema.json#/definitions/oic.oic-link" + } + }, + "oic.collection.alllinks": { + "description": "All forms of links in a collection", + "oneOf": [ + { + "$ref": "#/definitions/oic.collection.setoflinks" + } + ] + }, + "oic.collection": { + "type": "object", + "description": "A collection is a set (array) of tagged-link or set (array) of simple links along with additional properties to describe the collection itself", + "properties": { + "n": { + "type": "string", + "description": "User friendly name of the collection" }, + "id": { + "anyOf": [ + { + "type": "integer", + "description": "A number that is unique to that collection; like an ordinal number that is not repeated" + }, + { + "type": "string", + "description": "A unique string that could be a hash or similarly unique" + }, + { + "$ref": "oic.types-schema.json#/definitions/uuid", + "description": "A unique string that could be a UUIDv4" + } + ], + "description": "ID for the collection. Can be an value that is unique to the use context or a UUIDv4" + }, + "di": { + "$ref": "oic.types-schema.json#/definitions/uuid", + "description": "The device ID which is an UUIDv4 string; used for backward compatibility with Spec A definition of /oic/res" + }, + "rts": { + "$ref": "oic.core-schema.json#/definitions/oic.core/properties/rt", + "description": "Defines the list of allowable resource types (for Target and anchors) in links included in the collection; new links being created can only be from this list" }, + "drel": { + "type": "string", + "description": "When specified this is the default relationship to use when an OIC Link does not specify an explicit relationship with *rel* parameter" + }, + "links": { + "$ref": "#/definitions/oic.collection.alllinks" + } + } + } + }, + "type": "object", + "allOf": [ + {"$ref": "oic.core-schema.json#/definitions/oic.core"}, + {"$ref": "#/definitions/oic.collection"} + ] +} diff --git a/schemas/oic.collection.batch-retrieve-schema.json b/schemas/oic.collection.batch-retrieve-schema.json new file mode 100644 index 0000000..7618861 --- /dev/null +++ b/schemas/oic.collection.batch-retrieve-schema.json @@ -0,0 +1,34 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "description" : "Copyright (c) 2016 Open Connectivity Foundation, Inc. All rights reserved.", + "id": "https://www.openconnectivity.org/ocf-apis/core/schemas/oic.collection.batch-retrieve-schema.json#", + "title": "Collection Batch Retrieve Format", + "type": "array", + "minItems": 1, + "items": { + "type": "object", + "properties": { + "href": { + "type": "string", + "description": "URI of the target resource relative assuming the collection URI as anchor" + }, + "rep": { + "oneOf": [ + { + "type": "object", + "description": "The response payload from a single resource" + }, + { + "type": "array", + "description": " The response payload from a collection (batch) resource" + } + ] + } + }, + "additionalProperties": true, + "required": [ + "href", + "rep" + ] + } +} diff --git a/schemas/oic.collection.batch-update-schema.json b/schemas/oic.collection.batch-update-schema.json new file mode 100644 index 0000000..6f373c0 --- /dev/null +++ b/schemas/oic.collection.batch-update-schema.json @@ -0,0 +1,35 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "description" : "Copyright (c) 2016 Open Connectivity Foundation, Inc. All rights reserved.", + "id": "https://www.openconnectivity.org/ocf-apis/core/schemas/oic.collection.batch-update-schema.json#", + "title": "Collection Batch Update Format", + "type": "array", + "minItems": 1, + "items": { + "type": "object", + "properties": { + "href": { + "type": "string", + "description": "URI of the target resource relative assuming the collection URI as anchor" + }, + "rep": { + "oneOf": [ + { + "type": "object", + "description": "The response payload from a single resource" + }, + { + "type": "array", + "description": " The response payload from a collection (batch) resource" + } + ] + } + }, + "additionalProperties": true, + "required": [ + "href", + "rep" + ] + }, + "description": "array of resource representations to apply to the batch collection, using href to indicate which resource(s) in the batch to update. If the href property is empty, effectively making the URI reference to the collection itself, the representation is to be applied to all resources in the batch" +} diff --git a/schemas/oic.collection.linkslist-schema.json b/schemas/oic.collection.linkslist-schema.json new file mode 100644 index 0000000..677ce0a --- /dev/null +++ b/schemas/oic.collection.linkslist-schema.json @@ -0,0 +1,11 @@ +{ + "$schema": "http://json-schema.org/draft-v4/schema#", + "description" : "Copyright (c) 2016 Open Connectivity Foundation, Inc. All rights reserved.", + "id": "https://www.openconnectivity.org/ocf-apis/core/schemas/oic.collection.linkslist-schema.json#", + "definitions": { + "oic.collection.alllinks": { + "$ref": "oic.collection-schema.json#/definitions/oic.collection.alllinks" + } + }, + "$ref": "#/definitions/oic.collection.alllinks" +} diff --git a/schemas/oic.core-schema.json b/schemas/oic.core-schema.json new file mode 100755 index 0000000..7f89b2d --- /dev/null +++ b/schemas/oic.core-schema.json @@ -0,0 +1,53 @@ +{ + "id": "https://www.openconnectivity.org/ocf-apis/core/schemas/oic.core-schema.json#", + "$schema": "http://json-schema.org/draft-04/schema#", + "description" : "Copyright (c) 2016 Open Connectivity Foundation, Inc. All rights reserved.", + "title": "Core", + "definitions": { + "oic.core": { + "type": "object", + "properties": { + "rt": { + "type": "array", + "items" : [ + { + "type" : "string", + "maxLength": 64 + } + ], + "minItems" : 1, + "readOnly": true, + "description": "Resource Type" + }, + "if": { + "type": "array", + "items": [ + { + "type" : "string", + "enum" : ["oic.if.baseline", "oic.if.ll", "oic.if.b", "oic.if.lb", "oic.if.rw", "oic.if.r", "oic.if.a", "oic.if.s" ] + } + ], + "minItems": 1, + "readOnly": true, + "description": "The interface set supported by this resource" + }, + "n": { + "type": "string", + "maxLength": 64, + "readOnly": true, + "description": "Friendly name of the resource" + }, + "id": { + "type": "string", + "maxLength": 64, + "readOnly": true, + "description": "Instance ID of this specific resource" + } + } + } + }, + "type": "object", + "allOf": [ + { "$ref": "#/definitions/oic.core"} + ] +} diff --git a/schemas/oic.oic-link-schema.json b/schemas/oic.oic-link-schema.json new file mode 100755 index 0000000..598f9c9 --- /dev/null +++ b/schemas/oic.oic-link-schema.json @@ -0,0 +1,138 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "description" : "Copyright (c) 2016 Open Connectivity Foundation, Inc. All rights reserved.", + "id": "https://www.openconnectivity.org/ocf-apis/core/schemas/oic.oic-link-schema.json#", + "definitions": { + "oic.oic-link": { + "type": "object", + "properties": { + "href": { + "type": "string", + "maxLength": 256, + "description": "This is the target URI, it can be specified as a Relative Reference or fully-qualified URI. Relative Reference should be used along with the di parameter to make it unique.", + "format": "uri" + }, + "rel": { + "oneOf":[ + { + "type": "array", + "items": [ + { + "type": "string", + "maxLength": 64 + } + ], + "minItems": 1, + "default": ["hosts"] + }, + { + "type": "string", + "maxLength": 64, + "default": "hosts" + } + ], + "description": "The relation of the target URI referenced by the link to the context URI" + }, + "rt": { + "type": "array", + "items" : [ + { + "type" : "string", + "maxLength": 64 + } + ], + "minItems" : 1, + "description": "Resource Type" + }, + "if": { + "type": "array", + "items": [ + { + "type" : "string", + "enum" : ["oic.if.baseline", "oic.if.ll", "oic.if.b", "oic.if.rw", "oic.if.r", "oic.if.a", "oic.if.s" ] + } + ], + "minItems": 1, + "description": "The interface set supported by this resource" + }, + "di": { + "$ref": "oic.types-schema.json#/definitions/uuid", + "description": "Unique identifier for device (UUID)" + }, + "buri": { + "type": "string", + "description": "The base URI used to fully qualify a Relative Reference in the href parameter. Use the OCF Schema for URI", + "maxLength": 256, + "format": "uri" + }, + "p": { + "description": "Specifies the framework policies on the Resource referenced by the target URI", + "type": "object", + "properties": { + "bm": { + "description": "Specifies the framework policies on the Resource referenced by the target URI for e.g. observable and discoverable", + "type": "integer" + }, + "sec": { + "description": "Specifies if security needs to be turned on when looking to interact with the Resource", + "default": false, + "type": "boolean" + }, + "port": { + "description": "Secure port to be used for connection", + "type": "integer" + } + }, + "required" : ["bm"] + }, + "title": { + "type": "string", + "maxLength": 64, + "description": "A title for the link relation. Can be used by the UI to provide a context" + }, + "anchor": { + "type": "string", + "maxLength": 256, + "description": "This is used to override the context URI e.g. override the URI of the containing collection", + "format": "uri" + }, + "ins": { + "oneOf": [ + { + "type": "integer", + "description": "An ordinal number that is not repeated - must be unique in the collection context" + }, + { + "type": "string", + "maxLength": 256, + "format" : "uri", + "description": "Any unique string including a URI" + }, + { + "$ref": "oic.types-schema.json#/definitions/uuid", + "description": "Unique identifier (UUID)" + } + ], + "description": "The instance identifier for this web link in an array of web links - used in collections" + }, + "type": { + "type": "array", + "description": "A hint at the representation of the resource referenced by the target URI. This represents the media types that are used for both accepting and emitting", + "items" : [ + { + "type": "string", + "maxLength": 64 + } + ], + "minItems": 1, + "default": "application/cbor" + } + }, + "required": [ "href", "rt", "if" ] + } + }, + "type": "object", + "allOf": [ + { "$ref": "#/definitions/oic.oic-link" } + ] +} diff --git a/schemas/oic.rd.publish-schema.json b/schemas/oic.rd.publish-schema.json new file mode 100755 index 0000000..ac3a2ea --- /dev/null +++ b/schemas/oic.rd.publish-schema.json @@ -0,0 +1,26 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "description" : "Copyright (c) 2016 Open Connectivity Foundation, Inc. All rights reserved.", + "id": "https://www.openconnectivity.org/ocf-apis/core/schemas/oic.rd.publish-schema.json#", + "title": "RD Publish & Update", + "definitions": { + "oic.rd.publish": { + "description": "Publishes resources as OIC Links into the resource directory", + "properties": { + "linkSet": { + "$ref": "oic.collection-schema.json#/definitions/oic.collection.setof-tagged-setoflinks" + }, + "ttl": { + "type": "integer", + "description": "Time to indicate a RD, how long to keep this published item. After this time (in seconds) elapses, the RD invalidates the links. To keep link alive the publishing device updates the ttl using the update schema" + } + } + } + }, + "type": "object", + "allOf": [{ "$ref": "#/definitions/oic.rd.publish" }], + "required": [ "links" ], + "dependencies": { + "links": [ "ttl" ] + } +} diff --git a/schemas/oic.rd.selection-schema.json b/schemas/oic.rd.selection-schema.json new file mode 100755 index 0000000..bb3b371 --- /dev/null +++ b/schemas/oic.rd.selection-schema.json @@ -0,0 +1,70 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "description" : "Copyright (c) 2016 Open Connectivity Foundation, Inc. All rights reserved.", + "id": "https://www.openconnectivity.org/ocf-apis/core/schemas/oic.rd.selection-schema.json#", + "title" : "RD Selection", + "definitions": { + "oic.rd.attributes": { + "type": "object", + "properties": { + "n": { + "type": "string", + "description": "A human friendly name for the Resource Directory", + "format": "UTF8" + }, + "di": { + "$ref": "oic.types-schema.json#/definitions/uuid", + "description": "A unique identifier for the Resource Directory - the same as the device ID of the RD" + + }, + "sel": { + "description": "Selection criteria that a device wanting to publish to any RD can use to choose this Resource Directory over others that are discovered", + "oneOf": [ + { + "type": "object", + "properties": { + "pwr": { + "type": "string", + "enum": [ "ac", "batt", "safe" ], + "description": "A hint about how the RD is powered. If AC then this is stronger than battery powered. If source is reliable (safe) then appropriate mechanism for managing power failure exists" + }, + "conn": { + "type": "string", + "enum": [ "wrd", "wrls" ], + "description": "A hint about the networking connectivity of the RD. *wrd* if wired connected and *wrls* if wireless connected." + }, + "bw": { + "type": "string", + "description": "Qualitative bandwidth of the connection", + "enum": [ "high", "low", "lossy" ] + }, + "mf": { + "type": "integer", + "description": "Memory factor - Ratio of available memory to total memory expressed as a percentage" + }, + "load": { + "type": "array", + "items": { + "type": "number" + }, + "minitems": 3, + "maxitems": 3, + "description": "Current load capacity of the RD. Expressed as a load factor 3-tuple (upto two decimal points each). Load factor is based on request processed in a 1 minute, 5 minute window and 15 minute window" + } + } + }, + { + "type": "integer", + "minimum": 0, + "maximum": 100, + "description": "A bias factor calculated by the Resource directory - the value is in the range of 0 to 100 - 0 implies that RD is not to be selected. Client chooses RD with highest bias factor or randomly between RDs that have same bias factor" + } + ] + } + } + } + }, + "type": "object", + "allOf": [ {"$ref": "#/definitions/oic.rd.attributes"}], + "required": ["sel"] +} diff --git a/schemas/oic.sceneCollection-Update-schema.json b/schemas/oic.sceneCollection-Update-schema.json new file mode 100755 index 0000000..eb86ebd --- /dev/null +++ b/schemas/oic.sceneCollection-Update-schema.json @@ -0,0 +1,56 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "description" : "Copyright (c) 2016 Open Connectivity Foundation, Inc. All rights reserved.", + "id": "https://www.openconnectivity.org/ocf-apis/core/schemas/oic.sceneCollection-schema.json#", + "title" : "Scene Collection", + "definitions": { + "oic.sceneCollection": { + "type": "object", + "properties": { + "lastScene": { + "type": "string", + "description": "Last selected Scene, shall be part of sceneValues", + "format": "UTF8" + }, + "sceneValues": { + "type": "string", + "readOnly": true, + "description": "All available scene values", + "format": "CSV" + }, + "n": { + "type": "string", + "description": "Used to name the Scene collection", + "format": "UTF8" + }, + "id": { + "type": "string", + "description" : "A unique string that could be a hash or similarly unique" + }, + "rts": { + "type": "string", + "readOnly": true, + "description": "Defines the list of allowable resource types in links included in the collection; new links being created can only be from this list", + "format": "UTF8" + }, + "links": { + "type": "array", + "description": "Array of OIC web links that are reference from this collection", + "items" : { + "allOf": [ + { "$ref": "oic.oic-link-schema.json#/definitions/oic.oic-link" }, + { "required" : [ "ins" ] } + ] + } + } + }, + "required": [ "lastScene" ] + } + }, + + "type": "object", + "allOf" : [ + { "$ref": "oic.core-schema.json#/definitions/oic.core" }, + { "$ref": "#/definitions/oic.sceneCollection" } + ] +} diff --git a/schemas/oic.sceneCollection-schema.json b/schemas/oic.sceneCollection-schema.json new file mode 100755 index 0000000..0a8a7a7 --- /dev/null +++ b/schemas/oic.sceneCollection-schema.json @@ -0,0 +1,56 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "description" : "Copyright (c) 2016 Open Connectivity Foundation, Inc. All rights reserved.", + "id": "https://www.openconnectivity.org/ocf-apis/core/schemas/oic.sceneCollection-schema.json#", + "title" : "Scene Collection", + "definitions": { + "oic.sceneCollection": { + "type": "object", + "properties": { + "lastScene": { + "type": "string", + "description": "Last selected Scene, shall be part of sceneValues", + "format": "UTF8" + }, + "sceneValues": { + "type": "string", + "readOnly": true, + "description": "All available scene values", + "format": "CSV" + }, + "n": { + "type": "string", + "description": "Used to name the Scene collection", + "format": "UTF8" + }, + "id": { + "type": "string", + "description" : "A unique string that could be a hash or similarly unique" + }, + "rts": { + "type": "string", + "readOnly": true, + "description": "Defines the list of allowable resource types in links included in the collection; new links being created can only be from this list", + "format": "UTF8" + }, + "links": { + "type": "array", + "description": "Array of OIC web links that are reference from this collection", + "items" : { + "allOf": [ + { "$ref": "oic.oic-link-schema.json#/definitions/oic.oic-link" }, + { "required" : [ "ins" ] } + ] + } + } + }, + "required": [ "lastScene","sceneValues","rts","id" ] + } + }, + + "type": "object", + "allOf" : [ + { "$ref": "oic.core-schema.json#/definitions/oic.core" }, + { "$ref": "#/definitions/oic.sceneCollection" } + ] +} diff --git a/schemas/oic.sceneMember-schema.json b/schemas/oic.sceneMember-schema.json new file mode 100755 index 0000000..ae7502f --- /dev/null +++ b/schemas/oic.sceneMember-schema.json @@ -0,0 +1,61 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "description" : "Copyright (c) 2016 Open Connectivity Foundation, Inc. All rights reserved.", + "id": "https://www.openconnectivity.org/ocf-apis/core/schemas/oic.sceneMember-schema.json#", + "title" : "Scene Member", + "definitions": { + "oic.sceneMember": { + "type": "object", + "properties": { + "n": { + "type": "string", + "description": "Used to name the Scene collection", + "format": "UTF8" + }, + "id": { + "type": "string", + "description": "Can be an value that is unique to the use context or a UUIDv4" + }, + "SceneMappings" : { + "type": "array", + "description": "array of mappings per scene, can be 1", + "items": [ + { + "type": "object", + "properties": { + "scene": { + "type": "string", + "description": "Specifies a scene value that will acted upon" + }, + "memberProperty": { + "type": "string", + "readOnly": true, + "description": "property name that will be mapped" + }, + "memberValue": { + "type": "string", + "readOnly": true, + "description": "value of the Member Property" + } + }, + "required": [ "scene", "memberProperty", "memberValue" ] + } + ] + }, + + "link": { + "type": "string", + "description": "web link that points at an resource", + "$ref": "oic.oic-link-schema.json#" + } + }, + "required": [ "link" ] + } + }, + + "type": "object", + "allOf" : [ + { "$ref": "oic.core-schema.json#/definitions/oic.core" }, + { "$ref": "#/definitions/oic.sceneMember" } + ] +} diff --git a/schemas/oic.types-schema.json b/schemas/oic.types-schema.json new file mode 100644 index 0000000..6456259 --- /dev/null +++ b/schemas/oic.types-schema.json @@ -0,0 +1,17 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "description" : "Copyright (c) 2016 Open Connectivity Foundation, Inc. All rights reserved.", + "id": "https://www.openconnectivity.org/ocf-apis/core/schemas/oic.types-schema.json#", + "definitions" : { + "uuid": { + "description": "An identifier formatted according to IETF RFC 4122.", + "type":"string", + "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$" + }, + "date": { + "description": "As defined in ISO 8601. The format is [yyyy]-[mm]-[dd].", + "type": "string", + "pattern": "^([0-9]{4})-(1[0-2]|0[1-9])-(3[0-1]|2[0-9]|1[0-9]|0[1-9])$" + } + } +} diff --git a/schemas/oic.wk.con-schema.json b/schemas/oic.wk.con-schema.json new file mode 100755 index 0000000..f3d6844 --- /dev/null +++ b/schemas/oic.wk.con-schema.json @@ -0,0 +1,42 @@ +{ + "id": "https://www.openconnectivity.org/ocf-apis/core/schemas/oic.wk.con-schema.json#", + "$schema": "http://json-schema.org/draft-04/schema#", + "description" : "Copyright (c) 2016 Open Connectivity Foundation, Inc. All rights reserved.", + "definitions": { + "oic.wk.con": { + "type": "object", + "properties": { + "n": { + "type": "string", + "maxLength": 64, + "description": "Human friendly name" + }, + "loc": { + "type": "string", + "description": "Location information" + }, + "locn": { + "type": "string", + "maxLength": 64, + "description": "Human Friendly Name" + }, + "c": { + "type": "string", + "maxLength": 64, + "description": "Currency" + }, + "r": { + "type": "string", + "maxLength": 64, + "description": "Region" + } + } + } + }, + "type": "object", + "allOf": [ + { "$ref": "oic.core-schema.json#/definitions/oic.core"}, + { "$ref": "#/definitions/oic.wk.con" } + ], + "required": [ "n" ] +} diff --git a/schemas/oic.wk.d-schema.json b/schemas/oic.wk.d-schema.json new file mode 100755 index 0000000..fd31c60 --- /dev/null +++ b/schemas/oic.wk.d-schema.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json-schemas.org/draft-04/schema#", + "description" : "Copyright (c) 2016 Open Connectivity Foundation, Inc. All rights reserved.", + "id": "https://www.openconnectivity.org/ocf-apis/core/schemas/oic.wk.d-schema.json#", + "definitions": { + "oic.wk.d": { + "type": "object", + "properties": { + "n": { + "type": "string", + "maxLength": 64, + "readOnly": true, + "description": "Human friendly name" + }, + "di": { + "$ref": "oic.types-schema.json#/definitions/uuid", + "readOnly": true, + "description": "Unique identifier for device (UUID)" + }, + "icv": { + "type": "string", + "maxLength": 64, + "readOnly": true, + "description": "The version of the OIC Server" + }, + "dmv": { + "type": "string", + "maxLength": 64, + "readOnly": true, + "description": "The spec version of the vertical and/or resource specification" + } + } + } + }, + "type": "object", + "allOf": [ + { "$ref": "oic.core-schema.json#/definitions/oic.core"}, + { "$ref": "#/definitions/oic.wk.d" } + ], + "required": [ "n", "di", "icv", "dmv" ] +} diff --git a/schemas/oic.wk.mnt-schema.json b/schemas/oic.wk.mnt-schema.json new file mode 100755 index 0000000..abb9606 --- /dev/null +++ b/schemas/oic.wk.mnt-schema.json @@ -0,0 +1,31 @@ +{ + "$schema": "http://json-schemas.org/draft-04/schema#", + "description" : "Copyright (c) 2016 Open Connectivity Foundation, Inc. All rights reserved.", + "id": "https://www.openconnectivity.org/ocf-apis/core/schemas/oic.wk.mnt-schema.json#", + "definitions": { + "oic.wk.mnt": { + "type": "object", + "properties": { + "n": { + "type" : "string", + "maxLength" : 64, + "description": "Name" + }, + "fr":{ + "type": "boolean", + "description": "Factory Reset" + }, + "rb": { + "type": "boolean", + "description": "Reboot Action" + } + } + } + }, + "type": "object", + "allOf": [ + { "$ref": "oic.core-schema.json#/definitions/oic.core"}, + { "$ref": "#/definitions/oic.wk.mnt" } + ], + "required": ["fr"] +} diff --git a/schemas/oic.wk.p-schema.json b/schemas/oic.wk.p-schema.json new file mode 100755 index 0000000..8dc6692 --- /dev/null +++ b/schemas/oic.wk.p-schema.json @@ -0,0 +1,90 @@ +{ + "$schema": "http://json-schemas.org/draft-04/schema#", + "description" : "Copyright (c) 2016 Open Connectivity Foundation, Inc. All rights reserved.", + "id": "https://www.openconnectivity.org/ocf-apis/core/schemas/oic.wk.p-schema.json#", + "definitions": { + "oic.wk.p": { + "type": "object", + "properties": { + "pi": { + "$ref": "oic.types-schema.json#/definitions/uuid", + "readOnly": true, + "description": "Platform Identifier as a UUID" + }, + "mnmn": { + "type": "string", + "readOnly": true, + "description": "Manufacturer Name", + "maxLength": 64 + }, + "mnml": { + "type": "string", + "readOnly": true, + "description": "Manufacturer's URL", + "maxLength": 256, + "format": "uri" + }, + "mnmo": { + "type": "string", + "maxLength": 64, + "readOnly": true, + "description": "Model number as designated by manufacturer" + }, + "mndt": { + "$ref": "oic.types-schema.json#/definitions/date", + "readOnly": true, + "description": "Manufacturing Date." + }, + "mnpv": { + "type": "string", + "maxLength": 64, + "readOnly": true, + "description": "Platform Version" + }, + "mnos": { + "type": "string", + "maxLength": 64, + "readOnly": true, + "description": "Platform Resident OS Version" + }, + "mnhw": { + "type": "string", + "maxLength": 64, + "readOnly": true, + "description": "Platform Hardware Version" + }, + "mnfv": { + "type": "string", + "maxLength": 64, + "readOnly": true, + "description": "Manufacturer's firmware version" + }, + "mnsl": { + "type": "string", + "readOnly": true, + "description": "Manufacturer's Support Information URL", + "maxLength": 256, + "format": "uri" + }, + "st": { + "type": "string", + "readOnly": true, + "description": "Reference time for the device as defined in ISO 8601, where concatenation of 'date' and 'time' with the 'T' as a delimiter between 'date' and 'time'. The format is [yyyy]-[mm]-[dd]T[hh]:[mm]:[ss]Z.", + "format": "date-time" + }, + "vid": { + "type": "string", + "maxLength": 64, + "readOnly": true, + "description": "Manufacturer's defined string for the platform. The string is freeform and up to the manufacturer on what text to populate it" + } + } + } + }, + "type": "object", + "allOf": [ + { "$ref": "oic.core-schema.json#/definitions/oic.core"}, + { "$ref": "#/definitions/oic.wk.p" } + ], + "required": [ "pi", "mnmn" ] +} diff --git a/schemas/oic.wk.ping-schema.json b/schemas/oic.wk.ping-schema.json new file mode 100755 index 0000000..c08e050 --- /dev/null +++ b/schemas/oic.wk.ping-schema.json @@ -0,0 +1,24 @@ +{ + "$schema": "http://json-schemas.org/draft-04/schema#", + "description" : "Copyright (c) 2016 Open Connectivity Foundation, Inc. All rights reserved.", + "id": "https://www.openconnectivity.org/ocf-apis/core/schemas/oic.wk.ping-schema.json#", + "definitions": { + "oic.wk.ping": { + "type": "object", + "properties": { + "in": { + "type": "integer", + "description": "ReadWrite, Indicates the interval for which connection shall be kept alive" + } + } + } + }, + "type": "object", + "allOf": [ + { "$ref": "oic.core-schema.json#/definitions/oic.core"}, + { "$ref": "#/definitions/oic.wk.ping"} + ], + "required": [ + "in" + ] +} diff --git a/schemas/oic.wk.res-schema.json b/schemas/oic.wk.res-schema.json new file mode 100755 index 0000000..c4b1539 --- /dev/null +++ b/schemas/oic.wk.res-schema.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json-schema.org/draft-v4/schema#", + "description" : "Copyright (c) 2016 Open Connectivity Foundation, Inc. All rights reserved.", + "id": "https://www.openconnectivity.org/ocf-apis/core/schemas/oic.wk.res-schema.json#", + "definitions": { + "oic.res-links.json": { + "type": "object", + "properties": { + "n": { + "type": "string", + "maxLength": 64, + "readOnly": true, + "description": "Human friendly name" + }, + "di": { + "$ref": "oic.types-schema.json#/definitions/uuid", + "readOnly": true, + "description": "Unique identifier for device (UUID) as indicated by the /oic/d resource of the device" + }, + "mpro": { + "readOnly": true, + "description": "Supported messaging protocols", + "type": "string", + "maxLength": 64 + }, + "links": { + "type": "array", + "items": { + "$ref": "oic.oic-link-schema.json#/definitions/oic.oic-link" + } + } + }, + "required": ["di", "links"] + } + }, + "description": "The list of resources expressed as OIC links", + "type": "array", + "items": { + "$ref": "#/definitions/oic.res-links.json" + } +}