Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use patternProperties in more places with supported formats #1813

Merged
merged 3 commits into from
May 8, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Use `patternProperties` in more places with supported formats.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Use `patternProperties` in more places with supported formats.
18 changes: 11 additions & 7 deletions data/api/client-server/cross_signing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,12 @@ paths:
type: object
description: |-
A map of user ID to a map of key ID to signed JSON object.
additionalProperties:
type: object
additionalProperties:
patternProperties:
"^@":
x-pattern-format: mx-user-id
type: object
additionalProperties:
type: object
example: {
"@alice:example.com": {
"HIJKLMN": {
Expand Down Expand Up @@ -238,11 +240,13 @@ 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:
type: object
additionalProperties:
patternProperties:
"^@":
type: object
title: Error
x-pattern-format: mx-user-id
additionalProperties:
type: object
title: Error
example:
"@alice:example.com":
HIJKLMN:
Expand Down
10 changes: 6 additions & 4 deletions data/api/client-server/definitions/device_keys.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,12 @@ properties:
`<algorithm>:<device_id>` to the signature.

The signature is calculated using the process described at [Signing JSON](/appendices/#signing-json).
additionalProperties:
type: object
additionalProperties:
type: string
patternProperties:
"^@":
x-pattern-format: mx-user-id
type: object
additionalProperties:
type: string
example:
"@alice:example.com":
"ed25519:JLAFKJWSCS": "dSO80A01XiigH3uBiDVx/EjzaoycHcjq9lfQX0uWsqxl2giMIiSPR8a4d291W1ihKJL/a+myXS367WT6NAIcBA"
Expand Down
6 changes: 4 additions & 2 deletions data/api/client-server/definitions/one_time_keys.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
type: object
patternProperties:
"^@":
x-pattern-format: mx-user-id
type: object
required: ['key', 'signatures']
14 changes: 10 additions & 4 deletions data/api/client-server/key_backup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
95 changes: 56 additions & 39 deletions data/api/client-server/keys.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,13 @@ 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:
type: array
items:
type: string
description: device ID
patternProperties:
"^@":
x-pattern-format: mx-user-id
type: array
items:
type: string
description: device ID
example:
"@alice:example.com": []
required:
Expand Down Expand Up @@ -177,24 +179,26 @@ paths:
the information returned will be the same as uploaded via
`/keys/upload`, with the addition of an `unsigned`
property.
additionalProperties:
type: object
additionalProperties:
title: DeviceInformation
allOf:
- $ref: definitions/device_keys.yaml
properties:
unsigned:
title: UnsignedDeviceInfo
type: object
description: |-
Additional data added to the device key information
by intermediate servers, and not covered by the
signatures.
properties:
device_display_name:
type: string
description: The display name which the user set on the device.
patternProperties:
"^@":
x-pattern-format: mx-user-id
type: object
additionalProperties:
title: DeviceInformation
allOf:
- $ref: definitions/device_keys.yaml
properties:
unsigned:
title: UnsignedDeviceInfo
type: object
description: |-
Additional data added to the device key information
by intermediate servers, and not covered by the
signatures.
properties:
device_display_name:
type: string
description: The display name which the user set on the device.
example:
"@alice:example.com":
JLAFKJWSCS:
Expand All @@ -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"
Expand All @@ -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"
Expand All @@ -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"
Expand Down Expand Up @@ -297,12 +310,14 @@ paths:
description: |-
The keys to be claimed. A map from user ID, to a map from
device ID to algorithm name.
additionalProperties:
type: object
additionalProperties:
type: string
description: algorithm
example: signed_curve25519
patternProperties:
"^@":
x-pattern-format: mx-user-id
type: object
additionalProperties:
type: string
description: algorithm
example: signed_curve25519
example:
"@alice:example.com":
JLAFKJWSCS: signed_curve25519
Expand Down Expand Up @@ -342,10 +357,12 @@ 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:
type: object
additionalProperties:
$ref: "definitions/one_time_keys.yaml"
patternProperties:
"^@":
x-pattern-format: mx-user-id
type: object
additionalProperties:
$ref: "definitions/one_time_keys.yaml"
example:
"@alice:example.com":
JLAFKJWSCS:
Expand Down
26 changes: 14 additions & 12 deletions data/api/client-server/rooms.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -299,18 +299,20 @@ paths:
type: object
properties:
joined:
additionalProperties:
title: RoomMember
type: object
properties:
display_name:
type: string
description: The display name of the user this object is representing.
avatar_url:
type: string
format: uri
description: The avatar of the user this object is representing, as an [`mxc://`
URI](/client-server-api/#matrix-content-mxc-uris).
patternProperties:
"^@":
x-pattern-format: mx-user-id
title: RoomMember
type: object
properties:
display_name:
type: string
description: The display name of the user this object is representing.
avatar_url:
type: string
format: uri
description: The avatar of the user this object is representing, as an [`mxc://`
URI](/client-server-api/#matrix-content-mxc-uris).
description: A map from user ID to a RoomMember object.
type: object
examples:
Expand Down
40 changes: 22 additions & 18 deletions data/api/client-server/search.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -225,19 +225,21 @@ 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:
type: object
title: User Profile
properties:
displayname:
type: string
title: Display name
avatar_url:
type: string
format: uri
title: Avatar Url
patternProperties:
"^@":
x-pattern-format: mx-user-id
type: object
title: User Profile
properties:
displayname:
type: string
title: Display name
avatar_url:
type: string
format: uri
title: Avatar Url
events_before:
type: array
title: Events Before
Expand All @@ -262,13 +264,15 @@ 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:
type: array
title: Room State
items:
$ref: definitions/client_event.yaml
patternProperties:
"^!":
x-pattern-format: mx-room-id
type: array
title: Room State
items:
$ref: definitions/client_event.yaml
groups:
type: object
title: Groups
Expand Down
Loading