Use `patternProperties` in more places with supported formats (#1813)

Allows to have more places where the property name's type is better defined.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
tulir/msc4142
Kévin Commaille 7 months ago committed by GitHub
parent df1e799c51
commit b0df8e7fb5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1 @@
Use `patternProperties` in more places with supported formats.

@ -0,0 +1 @@
Use `patternProperties` in more places with supported formats.

@ -165,7 +165,9 @@ paths:
type: object
description: |-
A map of user ID to a map of key ID to signed JSON object.
additionalProperties:
patternProperties:
"^@":
x-pattern-format: mx-user-id
type: object
additionalProperties:
type: object
@ -238,8 +240,10 @@ paths:
A map from user ID to key ID to an error for any signatures
that failed. If a signature was invalid, the `errcode` will
be set to `M_INVALID_SIGNATURE`.
additionalProperties:
patternProperties:
"^@":
type: object
x-pattern-format: mx-user-id
additionalProperties:
type: object
title: Error

@ -53,7 +53,9 @@ properties:
`<algorithm>:<device_id>` to the signature.
The signature is calculated using the process described at [Signing JSON](/appendices/#signing-json).
additionalProperties:
patternProperties:
"^@":
x-pattern-format: mx-user-id
type: object
additionalProperties:
type: string

@ -20,6 +20,8 @@ additionalProperties:
Signature for the device. Mapped from user ID to signature object,
containing mapping from _key signing identifier_ to the signature
(see also: [Signing JSON](/appendices/#signing-json))
additionalProperties:
patternProperties:
"^@":
x-pattern-format: mx-user-id
type: object
required: ['key', 'signatures']

@ -840,8 +840,11 @@ paths:
rooms:
type: object
description: A map of room IDs to room key backup data.
additionalProperties:
$ref: definitions/room_key_backup.yaml
patternProperties:
"^!":
x-pattern-format: mx-room-id
allOf:
- $ref: definitions/room_key_backup.yaml
example:
"!room:example.org":
sessions:
@ -944,8 +947,11 @@ paths:
rooms:
type: object
description: A map of room IDs to room key backup data.
additionalProperties:
$ref: definitions/room_key_backup.yaml
patternProperties:
"^!":
x-pattern-format: mx-room-id
allOf:
- $ref: definitions/room_key_backup.yaml
example:
"!room:example.org":
sessions:

@ -137,7 +137,9 @@ paths:
The keys to be downloaded. A map from user ID, to a list of
device IDs, or to an empty list to indicate all devices for the
corresponding user.
additionalProperties:
patternProperties:
"^@":
x-pattern-format: mx-user-id
type: array
items:
type: string
@ -177,7 +179,9 @@ paths:
the information returned will be the same as uploaded via
`/keys/upload`, with the addition of an `unsigned`
property.
additionalProperties:
patternProperties:
"^@":
x-pattern-format: mx-user-id
type: object
additionalProperties:
title: DeviceInformation
@ -221,8 +225,11 @@ paths:
`/keys/device_signing/upload`, along with the signatures
uploaded via `/keys/signatures/upload` that the requesting user
is allowed to see.
additionalProperties:
$ref: definitions/cross_signing_key.yaml
patternProperties:
"^@":
x-pattern-format: mx-user-id
allOf:
- $ref: definitions/cross_signing_key.yaml
example:
"@alice:example.com":
user_id: "@alice:example.com"
@ -238,8 +245,11 @@ paths:
from user ID, to self-signing key information. For each key, the
information returned will be the same as uploaded via
`/keys/device_signing/upload`.
additionalProperties:
$ref: definitions/cross_signing_key.yaml
patternProperties:
"^@":
x-pattern-format: mx-user-id
allOf:
- $ref: definitions/cross_signing_key.yaml
example:
"@alice:example.com":
user_id: "@alice:example.com"
@ -258,8 +268,11 @@ paths:
from user ID, to user-signing key information. The
information returned will be the same as uploaded via
`/keys/device_signing/upload`.
additionalProperties:
$ref: definitions/cross_signing_key.yaml
patternProperties:
"^@":
x-pattern-format: mx-user-id
allOf:
- $ref: definitions/cross_signing_key.yaml
example:
"@alice:example.com":
user_id: "@alice:example.com"
@ -297,7 +310,9 @@ paths:
description: |-
The keys to be claimed. A map from user ID, to a map from
device ID to algorithm name.
additionalProperties:
patternProperties:
"^@":
x-pattern-format: mx-user-id
type: object
additionalProperties:
type: string
@ -342,7 +357,9 @@ paths:
If necessary, the claimed key might be a fallback key. Fallback
keys are re-used by the server until replaced by the device.
additionalProperties:
patternProperties:
"^@":
x-pattern-format: mx-user-id
type: object
additionalProperties:
$ref: "definitions/one_time_keys.yaml"

@ -299,7 +299,9 @@ paths:
type: object
properties:
joined:
additionalProperties:
patternProperties:
"^@":
x-pattern-format: mx-user-id
title: RoomMember
type: object
properties:

@ -225,9 +225,11 @@ paths:
The historic profile information of the
users that sent the events returned.
The `string` key is the user ID for which
The key is the user ID for which
the profile belongs to.
additionalProperties:
patternProperties:
"^@":
x-pattern-format: mx-user-id
type: object
title: User Profile
properties:
@ -262,9 +264,11 @@ paths:
This is included if the request had the
`include_state` key set with a value of `true`.
The `string` key is the room ID for which the `State
The key is the room ID for which the `State
Event` array belongs to.
additionalProperties:
patternProperties:
"^!":
x-pattern-format: mx-room-id
type: array
title: Room State
items:

@ -141,7 +141,9 @@ paths:
description: |-
The rooms that the user has joined, mapped as room ID to
room information.
additionalProperties:
patternProperties:
"^!":
x-pattern-format: mx-room-id
title: Joined Room
type: object
properties:
@ -269,7 +271,9 @@ paths:
If a thread does not have any notifications it can be omitted from this object. If
no threads have notification counts, this whole object can be omitted.
x-addedInMatrixVersion: "1.4"
additionalProperties:
patternProperties:
"^\\$":
x-pattern-format: mx-event-id
title: ThreadNotificationCounts
type: object
properties:
@ -288,7 +292,9 @@ paths:
description: |-
The rooms that the user has been invited to, mapped as room ID to
room information.
additionalProperties:
patternProperties:
"^!":
x-pattern-format: mx-room-id
title: Invited Room
type: object
properties:
@ -310,7 +316,9 @@ paths:
type: object
description: The rooms that the user has knocked upon, mapped as room ID to room
information.
additionalProperties:
patternProperties:
"^!":
x-pattern-format: mx-room-id
title: Knocked Room
type: object
properties:
@ -332,7 +340,9 @@ paths:
description: |-
The rooms that the user has left or been banned from, mapped as room ID to
room information.
additionalProperties:
patternProperties:
"^!":
x-pattern-format: mx-room-id
title: Left Room
type: object
properties:

@ -57,7 +57,9 @@ paths:
The messages to send. A map from user ID, to a map from
device ID to message body. The device ID may also be `*`,
meaning all known devices for the user.
additionalProperties:
patternProperties:
"^@":
x-pattern-format: mx-user-id
type: object
additionalProperties:
type: object

@ -51,7 +51,9 @@ allOf:
The contents of the messages to be sent. These are arranged in
a map of user IDs to a map of device IDs to message bodies.
The device ID may also be `*`, meaning all known devices for the user.
additionalProperties:
patternProperties:
"^@":
x-pattern-format: mx-user-id
type: object
title: User Devices
additionalProperties:

@ -33,7 +33,9 @@ allOf:
description: |-
Receipts for a particular room. The string key is the room ID for
which the receipts under it belong.
additionalProperties:
patternProperties:
"^!":
x-pattern-format: mx-room-id
type: object
title: Room Receipts
properties:
@ -44,7 +46,9 @@ allOf:
description: |-
Read receipts for users in the room. The string key is the user
ID the receipt belongs to.
additionalProperties:
patternProperties:
"^@":
x-pattern-format: mx-user-id
type: object
title: User Read Receipt
properties:

@ -74,7 +74,9 @@ paths:
description: |-
The PDUs from the original transaction. The string key represents the ID of the
PDU (event) that was processed.
additionalProperties:
patternProperties:
"^\\$":
x-pattern-format: mx-event-id
type: object
title: PDU Processing Result
description: Information about how the PDU was handled.

@ -36,7 +36,9 @@ paths:
The keys to be claimed. A map from user ID, to a map from
device ID to algorithm name. Requested users must be local
to the receiving homeserver.
additionalProperties:
patternProperties:
"^@":
x-pattern-format: mx-user-id
type: object
additionalProperties:
type: string
@ -65,7 +67,9 @@ paths:
See the [Client-Server Key Algorithms](/client-server-api/#key-algorithms) section for more information on
the Key Object format.
# User
additionalProperties:
patternProperties:
"^@":
x-pattern-format: mx-user-id
type: object
# Device
additionalProperties:
@ -124,7 +128,9 @@ paths:
device IDs, or to an empty list to indicate all devices for the
corresponding user. Requested users must be local to the
receiving homeserver.
additionalProperties:
patternProperties:
"^@":
x-pattern-format: mx-user-id
type: array
items:
type: string
@ -150,7 +156,9 @@ paths:
the information returned will be the same as uploaded via
`/keys/upload`, with the addition of an `unsigned`
property.
additionalProperties:
patternProperties:
"^@":
x-pattern-format: mx-user-id
type: object
additionalProperties:
allOf:
@ -177,8 +185,11 @@ paths:
`/keys/device_signing/upload`, along with the signatures
uploaded via `/keys/signatures/upload` that the user is
allowed to see.
additionalProperties:
$ref: ../client-server/definitions/cross_signing_key.yaml
patternProperties:
"^@":
x-pattern-format: mx-user-id
allOf:
- $ref: ../client-server/definitions/cross_signing_key.yaml
example:
"@alice:example.com":
user_id: "@alice:example.com"
@ -194,8 +205,11 @@ paths:
from user ID, to self-signing key information. For each key, the
information returned will be the same as uploaded via
`/keys/device_signing/upload`.
additionalProperties:
$ref: ../client-server/definitions/cross_signing_key.yaml
patternProperties:
"^@":
x-pattern-format: mx-user-id
allOf:
- $ref: ../client-server/definitions/cross_signing_key.yaml
example:
"@alice:example.com":
user_id: "@alice:example.com"

@ -32,6 +32,11 @@ mx-event-id:
url: /appendices#event-ids
# regex: "^\\$"
mx-room-id:
title: Room ID
url: /appendices#room-ids
# regex: "^!"
uri:
title: URI
url: http://tools.ietf.org/html/rfc3986

@ -9,7 +9,9 @@ description: |-
that user ID.
properties:
content:
additionalProperties:
patternProperties:
"^@":
x-pattern-format: mx-user-id
type: array
items:
type: string

@ -67,7 +67,9 @@ properties:
by the `events` key. Defaults to 50 if unspecified.
type: integer
users:
additionalProperties:
patternProperties:
"^@":
x-pattern-format: mx-user-id
type: integer
description: The power levels for specific users. This is a mapping from `user_id` to power level for that user.
title: User power levels

Loading…
Cancel
Save