diff --git a/changelogs/server_server/newsfragments/1559.clarification b/changelogs/server_server/newsfragments/1559.clarification new file mode 100644 index 00000000..401a94e0 --- /dev/null +++ b/changelogs/server_server/newsfragments/1559.clarification @@ -0,0 +1 @@ +Fix definition of response of `POST /_matrix/federation/v1/user/keys/claim`. diff --git a/data/api/server-server/user_keys.yaml b/data/api/server-server/user_keys.yaml index 60995a74..fb598e94 100644 --- a/data/api/server-server/user_keys.yaml +++ b/data/api/server-server/user_keys.yaml @@ -71,26 +71,28 @@ paths: type: object # Key additionalProperties: - type: object - title: KeyObject - properties: - key: - type: string - description: The key, encoded using unpadded base64. - signatures: - type: object - title: Signatures - additionalProperties: - type: object - additionalProperties: + oneOf: + - type: string + - type: object + title: KeyObject + properties: + key: type: string - description: |- - Signature of the key object. + description: The key, encoded using unpadded base64. + signatures: + type: object + title: Signatures + additionalProperties: + type: object + additionalProperties: + type: string + description: |- + Signature of the key object. - The signature is calculated using the process described at [Signing JSON](/appendices/#signing-json). - required: - - key - - signatures + The signature is calculated using the process described at [Signing JSON](/appendices/#signing-json). + required: + - key + - signatures example: "@alice:example.com": JLAFKJWSCS: diff --git a/layouts/partials/json-schema/resolve-additional-types.html b/layouts/partials/json-schema/resolve-additional-types.html index 58710076..449b4222 100644 --- a/layouts/partials/json-schema/resolve-additional-types.html +++ b/layouts/partials/json-schema/resolve-additional-types.html @@ -91,6 +91,21 @@ {{ end }} {{ end }} +{{/* + Handle object schemas using the `oneOf` keyword + (https://json-schema.org/understanding-json-schema/reference/combining.html#oneof) +*/}} +{{ if $this_object.oneOf }} + {{ range $idx, $item := $this_object.oneOf }} + {{ $additional_objects = partial "get-additional-objects" (dict + "this_object" $item + "additional_objects" $additional_objects + "anchor_base" $anchor_base + "name" (printf "%s.oneOf[%d]" $name $idx) + ) }} + {{ end }} +{{ end }} + {{ return $additional_objects }} diff --git a/layouts/partials/openapi/render-object-table.html b/layouts/partials/openapi/render-object-table.html index 4fc5ac76..0f5841a4 100644 --- a/layouts/partials/openapi/render-object-table.html +++ b/layouts/partials/openapi/render-object-table.html @@ -36,7 +36,7 @@ {{ $property := partial "json-schema/resolve-allof" $property }} {{ $type := $property.type }} - {{ if eq $property.type "object" }} + {{ if or (eq $property.type "object") (and $property.oneOf (reflect.IsSlice .oneOf)) }} {{ $type = partial "type-or-title" $property }} {{ end }} @@ -121,7 +121,7 @@ {{ $types := slice }} {{ range .oneOf }} - {{ $types = $types | append .type }} + {{ $types = $types | append (partial "type-or-title" .) }} {{ end }} {{ $type = delimit $types "|" }}