From 399e8609fd62d22901d283572b35cbffff413af5 Mon Sep 17 00:00:00 2001 From: Johannes Marbach Date: Thu, 18 Jul 2024 09:20:04 +0200 Subject: [PATCH 01/10] Handle additionalProperties: true like additionalProperties: {} Signed-off-by: Johannes Marbach --- layouts/partials/openapi/render-object-table.html | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/layouts/partials/openapi/render-object-table.html b/layouts/partials/openapi/render-object-table.html index 656f556a7..66658b9c1 100644 --- a/layouts/partials/openapi/render-object-table.html +++ b/layouts/partials/openapi/render-object-table.html @@ -67,12 +67,18 @@ TODO: support `patternProperties` here. */}} - {{ if reflect.IsMap .additionalProperties }} + {{/* Map `additionalProperties: true` to the equivalent `additionalProperties: {}` */}} + {{ $additionalProperties := .additionalProperties }} + {{ if eq $additionalProperties true }} + {{ $additionalProperties = dict }} + {{ end }} + + {{ if reflect.IsMap $additionalProperties }} <Other properties> - {{ partial "partials/property-type" .additionalProperties | safeHTML }} - {{ partial "partials/property-description" (dict "property" .additionalProperties) }} + {{ partial "partials/property-type" $additionalProperties | safeHTML }} + {{ partial "partials/property-description" (dict "property" $additionalProperties) }} {{ end }} From 63af782ad19aabde593113dacb52a8dc8c3b2da8 Mon Sep 17 00:00:00 2001 From: Johannes Marbach Date: Thu, 18 Jul 2024 09:25:49 +0200 Subject: [PATCH 02/10] Add changelog --- changelogs/client_server/newsfragments/1909.clarification | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelogs/client_server/newsfragments/1909.clarification diff --git a/changelogs/client_server/newsfragments/1909.clarification b/changelogs/client_server/newsfragments/1909.clarification new file mode 100644 index 000000000..fcd6629d1 --- /dev/null +++ b/changelogs/client_server/newsfragments/1909.clarification @@ -0,0 +1 @@ +The `UserIdentifier` object in `POST /_matrix/client/v3/login` can contain additional properties. From c0e5699c16ee7b52787cb694302ac841c22d438c Mon Sep 17 00:00:00 2001 From: Johannes Marbach Date: Thu, 18 Jul 2024 09:27:24 +0200 Subject: [PATCH 03/10] Add changelog --- changelogs/internal/newsfragments/1909.clarification | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelogs/internal/newsfragments/1909.clarification diff --git a/changelogs/internal/newsfragments/1909.clarification b/changelogs/internal/newsfragments/1909.clarification new file mode 100644 index 000000000..46c540a21 --- /dev/null +++ b/changelogs/internal/newsfragments/1909.clarification @@ -0,0 +1 @@ +Treat `additionalProperties: true` equivalent to `additionalProperties: {}` when rendering object tables. From 493058adab6d76d3363718d97b6d3600c2b3c091 Mon Sep 17 00:00:00 2001 From: Johannes Marbach Date: Tue, 23 Jul 2024 13:23:32 +0200 Subject: [PATCH 04/10] Enforce `additionalProperties: {}` instead of the equivalent `additionalProperties: true` for easier processing --- .../internal/newsfragments/1909.clarification | 2 +- .../client-server/definitions/user_identifier.yaml | 2 +- layouts/partials/openapi/render-object-table.html | 13 ++++++------- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/changelogs/internal/newsfragments/1909.clarification b/changelogs/internal/newsfragments/1909.clarification index 46c540a21..a82cb9c51 100644 --- a/changelogs/internal/newsfragments/1909.clarification +++ b/changelogs/internal/newsfragments/1909.clarification @@ -1 +1 @@ -Treat `additionalProperties: true` equivalent to `additionalProperties: {}` when rendering object tables. +Enforce `additionalProperties: {}` instead of the equivalent `additionalProperties: true` for easier processing. diff --git a/data/api/client-server/definitions/user_identifier.yaml b/data/api/client-server/definitions/user_identifier.yaml index 7e6eca9c6..4511f2177 100644 --- a/data/api/client-server/definitions/user_identifier.yaml +++ b/data/api/client-server/definitions/user_identifier.yaml @@ -21,4 +21,4 @@ properties: description: The type of identification. See [Identifier types](/client-server-api/#identifier-types) for supported values and additional property descriptions. required: - type -additionalProperties: true +additionalProperties: {} diff --git a/layouts/partials/openapi/render-object-table.html b/layouts/partials/openapi/render-object-table.html index 66658b9c1..daedfc41c 100644 --- a/layouts/partials/openapi/render-object-table.html +++ b/layouts/partials/openapi/render-object-table.html @@ -68,17 +68,16 @@ TODO: support `patternProperties` here. */}} - {{/* Map `additionalProperties: true` to the equivalent `additionalProperties: {}` */}} - {{ $additionalProperties := .additionalProperties }} - {{ if eq $additionalProperties true }} - {{ $additionalProperties = dict }} + {{/* Enforce `additionalProperties: {}` instead of the equivalent `additionalProperties: true` for easier processing */}} + {{ if eq .additionalProperties true }} + {{ errorf "Use `additionalProperties: {}` instead of `additionalProperties: true`" }} {{ end }} - {{ if reflect.IsMap $additionalProperties }} + {{ if reflect.IsMap .additionalProperties }} <Other properties> - {{ partial "partials/property-type" $additionalProperties | safeHTML }} - {{ partial "partials/property-description" (dict "property" $additionalProperties) }} + {{ partial "partials/property-type" .additionalProperties | safeHTML }} + {{ partial "partials/property-description" (dict "property" .additionalProperties) }} {{ end }} From 6849bfdb51fed087c17ad741d70164a7c5a07c6e Mon Sep 17 00:00:00 2001 From: Johannes Marbach Date: Tue, 23 Jul 2024 13:24:49 +0200 Subject: [PATCH 05/10] Relocate the assertion --- layouts/partials/openapi/render-object-table.html | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/layouts/partials/openapi/render-object-table.html b/layouts/partials/openapi/render-object-table.html index daedfc41c..76f3577b0 100644 --- a/layouts/partials/openapi/render-object-table.html +++ b/layouts/partials/openapi/render-object-table.html @@ -53,6 +53,11 @@ {{ end }} + {{/* Enforce `additionalProperties: {}` instead of the equivalent `additionalProperties: true` for easier processing */}} + {{ if eq .additionalProperties true }} + {{ errorf "Use `additionalProperties: {}` instead of `additionalProperties: true`" }} + {{ end }} + {{/* If the object has additional properties *as well as* regular properties, we add a special row to the table. @@ -67,12 +72,6 @@ TODO: support `patternProperties` here. */}} - - {{/* Enforce `additionalProperties: {}` instead of the equivalent `additionalProperties: true` for easier processing */}} - {{ if eq .additionalProperties true }} - {{ errorf "Use `additionalProperties: {}` instead of `additionalProperties: true`" }} - {{ end }} - {{ if reflect.IsMap .additionalProperties }} <Other properties> From 20c109c3a710ed68ef101b4a791a22b4c407b4bd Mon Sep 17 00:00:00 2001 From: Johannes Marbach Date: Tue, 23 Jul 2024 13:25:12 +0200 Subject: [PATCH 06/10] Restore blank line --- layouts/partials/openapi/render-object-table.html | 1 + 1 file changed, 1 insertion(+) diff --git a/layouts/partials/openapi/render-object-table.html b/layouts/partials/openapi/render-object-table.html index 76f3577b0..ae84bf996 100644 --- a/layouts/partials/openapi/render-object-table.html +++ b/layouts/partials/openapi/render-object-table.html @@ -73,6 +73,7 @@ TODO: support `patternProperties` here. */}} {{ if reflect.IsMap .additionalProperties }} + <Other properties> {{ partial "partials/property-type" .additionalProperties | safeHTML }} From de615f5bd78d04ca075e12ee07fcb85d351d8728 Mon Sep 17 00:00:00 2001 From: Johannes Marbach Date: Wed, 24 Jul 2024 13:12:30 +0200 Subject: [PATCH 07/10] Switch from additionalProperties: {} to using a description --- changelogs/client_server/newsfragments/1909.clarification | 2 +- changelogs/internal/newsfragments/1909.clarification | 1 - data/api/client-server/definitions/user_identifier.yaml | 7 +++++-- layouts/partials/openapi/render-object-table.html | 8 +++----- 4 files changed, 9 insertions(+), 9 deletions(-) delete mode 100644 changelogs/internal/newsfragments/1909.clarification diff --git a/changelogs/client_server/newsfragments/1909.clarification b/changelogs/client_server/newsfragments/1909.clarification index fcd6629d1..85cf15b6d 100644 --- a/changelogs/client_server/newsfragments/1909.clarification +++ b/changelogs/client_server/newsfragments/1909.clarification @@ -1 +1 @@ -The `UserIdentifier` object in `POST /_matrix/client/v3/login` can contain additional properties. +The `UserIdentifier` object in `POST /_matrix/client/v3/login` contains additional properties that depend on the identification type. diff --git a/changelogs/internal/newsfragments/1909.clarification b/changelogs/internal/newsfragments/1909.clarification deleted file mode 100644 index a82cb9c51..000000000 --- a/changelogs/internal/newsfragments/1909.clarification +++ /dev/null @@ -1 +0,0 @@ -Enforce `additionalProperties: {}` instead of the equivalent `additionalProperties: true` for easier processing. diff --git a/data/api/client-server/definitions/user_identifier.yaml b/data/api/client-server/definitions/user_identifier.yaml index 4511f2177..d2d88fe4b 100644 --- a/data/api/client-server/definitions/user_identifier.yaml +++ b/data/api/client-server/definitions/user_identifier.yaml @@ -18,7 +18,10 @@ type: object properties: type: type: string - description: The type of identification. See [Identifier types](/client-server-api/#identifier-types) for supported values and additional property descriptions. + description: |- + The type of identification. See [Identifier types](/client-server-api/#identifier-types) + for supported values and additional property descriptions. required: - type -additionalProperties: {} +additionalProperties: + description: Keys dependent on the identification type diff --git a/layouts/partials/openapi/render-object-table.html b/layouts/partials/openapi/render-object-table.html index ae84bf996..778fdbc5d 100644 --- a/layouts/partials/openapi/render-object-table.html +++ b/layouts/partials/openapi/render-object-table.html @@ -53,11 +53,6 @@ {{ end }} - {{/* Enforce `additionalProperties: {}` instead of the equivalent `additionalProperties: true` for easier processing */}} - {{ if eq .additionalProperties true }} - {{ errorf "Use `additionalProperties: {}` instead of `additionalProperties: true`" }} - {{ end }} - {{/* If the object has additional properties *as well as* regular properties, we add a special row to the table. @@ -72,6 +67,9 @@ TODO: support `patternProperties` here. */}} + {{ if eq .additionalProperties true }} + {{ errorf "`additionalProperties: true` is de facto the default for Matrix and doesn't provide any information" }} + {{ end }} {{ if reflect.IsMap .additionalProperties }} From 9699bbad78f4e51fa2a4ce0a8ef8fdbd1281b873 Mon Sep 17 00:00:00 2001 From: Johannes Marbach Date: Wed, 24 Jul 2024 13:13:43 +0200 Subject: [PATCH 08/10] Fix spelling of 'User identifier' --- changelogs/client_server/newsfragments/1909.clarification | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelogs/client_server/newsfragments/1909.clarification b/changelogs/client_server/newsfragments/1909.clarification index 85cf15b6d..da6575cd4 100644 --- a/changelogs/client_server/newsfragments/1909.clarification +++ b/changelogs/client_server/newsfragments/1909.clarification @@ -1 +1 @@ -The `UserIdentifier` object in `POST /_matrix/client/v3/login` contains additional properties that depend on the identification type. +The `User identifier` object in `POST /_matrix/client/v3/login` contains additional properties that depend on the identification type. From 2ac8c42d1d485366aa7a98dc9def436b09d79610 Mon Sep 17 00:00:00 2001 From: Johannes Marbach Date: Thu, 25 Jul 2024 11:40:20 +0200 Subject: [PATCH 09/10] Remove error on `additionalProperties: true` --- layouts/partials/openapi/render-object-table.html | 3 --- 1 file changed, 3 deletions(-) diff --git a/layouts/partials/openapi/render-object-table.html b/layouts/partials/openapi/render-object-table.html index 778fdbc5d..656f556a7 100644 --- a/layouts/partials/openapi/render-object-table.html +++ b/layouts/partials/openapi/render-object-table.html @@ -67,9 +67,6 @@ TODO: support `patternProperties` here. */}} - {{ if eq .additionalProperties true }} - {{ errorf "`additionalProperties: true` is de facto the default for Matrix and doesn't provide any information" }} - {{ end }} {{ if reflect.IsMap .additionalProperties }} From 726c646aa88a0212d9346fbc9983e769e5051952 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff <1389908+richvdh@users.noreply.github.com> Date: Tue, 30 Jul 2024 18:36:24 +0100 Subject: [PATCH 10/10] Update data/api/client-server/definitions/user_identifier.yaml --- data/api/client-server/definitions/user_identifier.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/api/client-server/definitions/user_identifier.yaml b/data/api/client-server/definitions/user_identifier.yaml index d2d88fe4b..add848fd6 100644 --- a/data/api/client-server/definitions/user_identifier.yaml +++ b/data/api/client-server/definitions/user_identifier.yaml @@ -24,4 +24,4 @@ properties: required: - type additionalProperties: - description: Keys dependent on the identification type + description: Keys dependent on the identification type.