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

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

Loading…
Cancel
Save