Give valid swagger. Split out rule/ruleset to separate definitions.

pull/977/head
Kegan Dougal 9 years ago
parent db25276856
commit f6da9d7760

@ -0,0 +1,20 @@
{
"type": "object",
"properties": {
"default": {
"type": "boolean"
},
"enabled": {
"type": "boolean"
},
"rule_id": {
"type": "string"
},
"actions": {
"items": {
"type": ["object", "string"]
},
"type": "array"
}
}
}

@ -1,12 +0,0 @@
type: "object"
properties:
rule_id:
type: string
actions:
type: array
items:
type: string
default:
type: boolean
enabled:
type: boolean

@ -0,0 +1,60 @@
{
"type": "object",
"properties": {
"content": {
"items": {
"type": "object",
"allOf": [
{
"$ref": "push_rule.json"
}
]
},
"type": "array"
},
"override": {
"items": {
"type": "object",
"allOf": [
{
"$ref": "push_rule.json"
}
]
},
"type": "array"
},
"sender": {
"items": {
"type": "object",
"allOf": [
{
"$ref": "push_rule.json"
}
]
},
"type": "array"
},
"underride": {
"items": {
"type": "object",
"allOf": [
{
"$ref": "push_rule.json"
}
]
},
"type": "array"
},
"room": {
"items": {
"type": "object",
"allOf": [
{
"$ref": "push_rule.json"
}
]
},
"type": "array"
}
}
}

@ -1,27 +0,0 @@
type: "object"
properties:
content:
type: array
items:
type: object
allOf: [ "$ref": "definitions/push_rule.yaml"]
override:
type: array
items:
type: object
allOf: [ "$ref": "definitions/push_rule.yaml"]
room:
type: array
items:
type: object
allOf: [ "$ref": "definitions/push_rule.yaml"]
sender:
type: array
items:
type: object
allOf: [ "$ref": "definitions/push_rule.yaml"]
underride:
type: array
items:
type: object
allOf: [ "$ref": "definitions/push_rule.yaml"]

@ -30,6 +30,7 @@ paths:
- accessToken: []
responses:
200:
description: All the push rulesets for this user.
schema:
type: object
required: ["device", "global"]
@ -38,21 +39,20 @@ paths:
type: object
title: Devices
description: A dictionary of devices.
patternProperties:
".*":
additionalProperties:
x-pattern: "$PROFILE_TAG"
type: object
description: The ruleset for this profile tag.
title: Ruleset
allOf: [
"$ref": "definitions/push_ruleset.yaml"
"$ref": "definitions/push_ruleset.json"
]
global:
type: object
description: The global ruleset.
title: Ruleset
allOf: [
"$ref": "definitions/push_ruleset.yaml"
"$ref": "definitions/push_ruleset.json"
]
examples:
application/json: |-
@ -292,14 +292,11 @@ paths:
}
schema:
type: object
required: ["enabled", "rule_id", "actions"]
properties:
enabled:
type: boolean
description: Whether this rule is active or not.
rule_id:
type: string
description: The rule ID from the path.
description: The push rule.
title: PushRule
allOf: [
"$ref": "definitions/push_rule.json"
]
delete:
summary: Delete a push rule.
description: |-
@ -330,6 +327,14 @@ paths:
x-example: "#spam:example.com"
description: |
The identifier for the rule.
responses:
200:
description: The push rule was deleted.
examples:
application/json: |-
{}
schema:
type: object # empty json object
put:
summary: Add or change a push rule.
description: |-

Loading…
Cancel
Save