Update third party network schemas

Some information was missed when this was reviewed. This commit adds some additional documentation for how these objects interact with each other.
pull/977/head
Travis Ralston 6 years ago
parent 9eda1a6971
commit 2d43ff1234

@ -19,12 +19,14 @@ properties:
protocol: protocol:
description: The protocol ID that the third party location is a part of. description: The protocol ID that the third party location is a part of.
type: string type: string
example: irc example: "irc"
fields: fields:
description: Information used to identify this third party location. description: Information used to identify this third party location.
type: object type: object
example: example: {
"network": "freenode" "network": "freenode",
"channel": "#matrix" "channel": "#matrix"
}
required: ['alias', 'protocol', 'fields']
title: Location title: Location
type: object type: object

@ -11,41 +11,60 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
title: Protocol
type: object
properties: properties:
user_fields: user_fields:
description: Fields used to identify a third party user. description: |-
Fields which may be used to identify a third party user. These should be
ordered to suggest the way that entities may be grouped, where higher
groupings are ordered first. For example, the name of a network should be
searched before the nickname of a user.
type: array type: array
items: items:
type: string type: string
description: Field used to identify a third party user. description: Field used to identify a third party user.
example: ["network", "nickname"] example: ["network", "nickname"]
location_fields: location_fields:
description: Fields used to identify a third party location. description: |-
Fields which may be used to identify a third party location. These should be
ordered to suggest the way that entities may be grouped, where higher
groupings are ordered first. For example, the name of a network should be
searched before the name of a channel.
type: array type: array
items: items:
type: string type: string
description: Field used to identify a third party location. description: Field used to identify a third party location.
example: ["network", "channel"] example: ["network", "channel"]
icon: icon:
description: An icon representing the third party protocol. description: A content URI representing an icon for the third party protocol.
type: string type: string
example: "mxc://example.org/aBcDeFgH" example: "mxc://example.org/aBcDeFgH"
field_types: field_types:
title: Field Types title: Field Types
description: All location or user fields should have an entry here. description: |-
The type definitions for the fields defined in the ``user_fields`` and
``location_fields``. Each entry in those arrays MUST have an entry here. The
``string`` key for this object is field name itself.
May be an empty object if no fields are defined.
type: object type: object
properties: additionalProperties:
fieldname:
title: Field Type title: Field Type
description: Definition of valid values for a field. description: Definition of valid values for a field.
type: object type: object
properties: properties:
regexp: regexp:
description: A regular expression for validation of a field's value. description: |-
A regular expression for validation of a field's value. This may be relatively
coarse to verify the value as the application service providing this protocol
may apply additional validation or filtering.
type: string type: string
placeholder: placeholder:
description: An placeholder serving as a valid example of the field value. description: An placeholder serving as a valid example of the field value.
type: string type: string
required: ['regexp', 'placeholder']
required: ['fieldname']
example: { example: {
"network": { "network": {
"regexp": "([a-z0-9]+\\.)*[a-z0-9]+", "regexp": "([a-z0-9]+\\.)*[a-z0-9]+",
@ -63,17 +82,32 @@ properties:
instances: instances:
description: |- description: |-
A list of objects representing independent instances of configuration. A list of objects representing independent instances of configuration.
For instance multiple networks on IRC if multiple are bridged by the For example, multiple networks on IRC if multiple are provided by the
same bridge. same application service.
type: array type: array
items: items:
type: object type: object
title: Protocol Instance
properties:
desc:
type: string
description: A human-readable description for the protocol, such as the name.
example: "Freenode"
icon:
type: string
description: |-
An optional content URI representing the protocol. Overrides the one provided
at the higher level Protocol object.
example: "mxc://example.org/JkLmNoPq"
fields:
type: object
description: Preset values for ``fields`` the client may use to search by.
example: { example: {
"desc": "Freenode", "network": "freenode"
"icon": "mxc://example.org/JkLmNoPq",
"fields": {
"network": "freenode.net",
} }
} network_id:
title: Protocol type: string
type: object description: A unique identifier across all instances.
example: "freenode"
required: ['desc', 'fields', 'network_id']
required: ['user_fields', 'location_fields', 'icon', 'field_types', 'instances']

@ -36,6 +36,7 @@ example: {
}, },
"instances": [ "instances": [
{ {
"network_id": "freenode",
"desc": "Freenode", "desc": "Freenode",
"icon": "mxc://example.org/JkLmNoPq", "icon": "mxc://example.org/JkLmNoPq",
"fields": { "fields": {
@ -59,6 +60,7 @@ example: {
}, },
"instances": [ "instances": [
{ {
"network_id": "gitter",
"desc": "Gitter", "desc": "Gitter",
"icon": "mxc://example.org/zXyWvUt", "icon": "mxc://example.org/zXyWvUt",
"fields": {} "fields": {}

@ -21,11 +21,13 @@ properties:
protocol: protocol:
description: The protocol ID that the third party location is a part of. description: The protocol ID that the third party location is a part of.
type: string type: string
example: gitter example: "gitter"
fields: fields:
description: Information used to identify this third party location. description: Information used to identify this third party location.
type: object type: object
example: example: {
"user": "jim" "user": "jim"
}
required: ['userid', 'protocol', 'fields']
title: User title: User
type: object type: object
Loading…
Cancel
Save