Skip to content

Commit

Permalink
Approved: Bugzilla-1556-CleanupForSwagger
Browse files Browse the repository at this point in the history
  • Loading branch information
marktrayer authored and oneIoTa Admin committed May 22, 2017
1 parent 872162e commit 8481921
Show file tree
Hide file tree
Showing 6 changed files with 297 additions and 284 deletions.
151 changes: 80 additions & 71 deletions SelectableLevels.raml
@@ -1,71 +1,80 @@
#%RAML 0.8
title: OICSelectableLevels
version: v1.1.0-20160519
documentation:
- title: © 2016 Open Connectivity Foundation, Inc. All rights reserved.
content: |
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.
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.
schemas:
- SelectableLevels: !include oic.r.selectablelevels.json
- UpdateSchema: !include oic.r.selectablelevels-Update.json

traits:
- interface:
queryParameters:
if:
enum: ["oic.if.a","oic.if.baseline"]

/SelectableLevelsResURI:
description: |
This Resource provides a set of device defined 'levels' that can be selected for an operation.
For example where a humidifier has a discrete set that model different humidity levels that can be set.
availablelevels is an array of the levels that can be selected, these can be a number or an integer.
targetlevel is the level that has currently been selected and is written to in order to select a new level.
When retrieved the targetlevel provides the actual value that has been selected.
displayName: Selectable Levels
is: [ interface ] # valid for all methods

get:
description: |
Retrieves the current selectable levels.
responses:
200:
body:
application/json:
schema: SelectableLevels
example: |
{
"rt": ["oic.r.selectablelevels"],
"id": "unique_example_id",
"availablelevels":[0,2,4,6,8],
"targetlevel": 2
}
post:
description:
Sets the current level from the set that is selectable
body:
application/json:
schema: UpdateSchema
example: |
{
"targetlevel": 4
}
responses:
200:
body:
application/json:
schema: UpdateSchema
example: |
{
"targetlevel": 4
}
403:
description:
Generated by a Server when an attempt is made to update to a targetlevel that is not in the set of availablelevels
#%RAML 0.8
title: OICSelectableLevels
version: v1.1.0-20160519
documentation:
- title: © 2016 Open Connectivity Foundation, Inc. All rights reserved.
content: |
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.
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.
schemas:
- SelectableLevels: !include oic.r.selectablelevels.json
- UpdateSchema: !include oic.r.selectablelevels-Update.json

traits:
- interface:
queryParameters:
if:
enum: ["oic.if.a","oic.if.baseline"]

/SelectableLevelsResURI:
description: |
This Resource provides a set of device defined 'levels' that can be selected for an operation.
For example where a humidifier has a discrete set that model different humidity levels that can be set.
availablelevels is an array of the levels that can be selected, these can be a number or an integer.
targetlevel is the level that has currently been selected and is written to in order to select a new level.
When retrieved the targetlevel provides the actual value that has been selected.
displayName: Selectable Levels
is: [ interface ] # valid for all methods

get:
description: |
Retrieves the current selectable levels.
responses:
200:
body:
application/json:
schema: SelectableLevels
example: |
{
"rt": ["oic.r.selectablelevels"],
"id": "unique_example_id",
"availablelevels":[0,2,4,6,8],
"targetlevel": 2
}
post:
description:
Sets the current level from the set that is selectable
body:
application/json:
schema: UpdateSchema
example: |
{
"targetlevel": 4
}
responses:
200:
body:
application/json:
schema: UpdateSchema
example: |
{
"targetlevel": 4
}
403:
description:
Generated by a Server when an attempt is made to update to a targetlevel that is not in the set of availablelevels
body:
application/json:
schema: SelectableLevels
example: |
{
"id": "unique_example_id",
"availablelevels":[0,2,4,6,8],
"targetlevel": 2
}
142 changes: 70 additions & 72 deletions baseResourceSchema.raml
@@ -1,72 +1,70 @@
#%RAML 0.8
title: OICBaseResourceSchema
version: v1.1.0-20160519
documentation:
- title: © 2016 Open Connectivity Foundation, Inc. All rights reserved.
content: |
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.
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.
schemas:
- baseCore: !include oic.basecorecomposite.json
- base: !include oic.baseResource.json


traits:
- interface-a:
queryParameters:
if:
enum: ["oic.if.a"]
- interface-baseline:
queryParameters:
if:
enum: ["oic.if.baseline"]

/BaseResourceSchemaResURI:
description: |
This is the base resource schema on which all other resources defined in this specification build.
value is the sensed or actuated value of the Resource.
precision is the accuracy granularity of the value.
range is the range over which value is valid.
step is the step function over the defined range if applicable (e.g. always step by '2').
displayName: Base Resource Schema

get:
is: [ interface-baseline ]
description: retrieves the state of the resource.
responses:
200:
body:
application/json:
schema: baseCore
example: |
{
"rt" : ["oic.baseresource"],
"if": ["oic.if.baseline"],
"id": "unique_example_id",
"value": 10.5,
"precision": 0.5,
"range": [0.0,100.0]
}
post:
is: [ interface-a ]
description: sets the read-write resource properties
body:
application/json:
schema: base
example: |
{
"value": 20.5
}
responses:
200:
body:
application/json:
schema: base
example: |
{
"value": 20.5
}
#%RAML 0.8
title: OICBaseResourceSchema
version: v1.1.0-20160519
documentation:
- title: © 2016 Open Connectivity Foundation, Inc. All rights reserved.
content: |
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.
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.
schemas:
- base: !include oic.baseResource.json

traits:
- interface-a:
queryParameters:
if:
enum: ["oic.if.a"]
- interface-baseline:
queryParameters:
if:
enum: ["oic.if.baseline"]

/BaseResourceSchemaResURI:
description: |
This is the base resource schema on which all other resources defined in this specification build.
value is the sensed or actuated value of the Resource.
precision is the accuracy granularity of the value.
range is the range over which value is valid.
step is the step function over the defined range if applicable (e.g. always step by '2').
displayName: Base Resource Schema

get:
is: [ interface-baseline ]
description: retrieves the state of the resource.
responses:
200:
body:
application/json:
schema: base
example: |
{
"rt" : ["oic.baseresource"],
"if": ["oic.if.baseline"],
"id": "unique_example_id",
"value": 10.5,
"precision": 0.5,
"range": [0.0,100.0]
}
post:
is: [ interface-a ]
description: sets the read-write resource properties
body:
application/json:
schema: base
example: |
{
"value": 20.5
}
responses:
200:
body:
application/json:
schema: base
example: |
{
"value": 20.5
}
48 changes: 25 additions & 23 deletions oic.r.airqualitycollection.json
Expand Up @@ -11,29 +11,31 @@
"$ref": "oic.collection-schema.json#/definitions/oic.collection"
},
{
"rt": {
"type": "array",
"minItems": 2,
"maxItems": 2,
"uniqueItems": true,
"items": {
"enum": ["oic.r.airqualitycollection","oic.wk.col"]
}
},
"rts": {
"type": "array",
"minItems": 1,
"maxItems": 2,
"uniqueItems": true,
"items": {
"oneOf": [
{
"enum": ["oic.r.airquality","oic.r.value.conditional"]
},
{
"enum": ["oic.r.airquality"]
}
]
"properties": {
"rt": {
"type": "array",
"minItems": 2,
"maxItems": 2,
"uniqueItems": true,
"items": {
"enum": ["oic.r.airqualitycollection","oic.wk.col"]
}
},
"rts": {
"type": "array",
"minItems": 1,
"maxItems": 2,
"uniqueItems": true,
"items": {
"oneOf": [
{
"enum": ["oic.r.airquality","oic.r.value.conditional"]
},
{
"enum": ["oic.r.airquality"]
}
]
}
}
}
}
Expand Down

0 comments on commit 8481921

Please sign in to comment.