From 3a037ae23ddb6641a776b786ca0752059b847833 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Mon, 10 Jun 2024 11:36:25 +0200 Subject: [PATCH] GTAD: update to support Matrix 1.11 - GTAD itself had to be updated to support patternProperties and mx-* format names - gtad.yaml now substitutes `{{% boxes/note %}}` with a Doxygen \note tag (see also https://github.com/matrix-org/matrix-spec/issues/1873) - endpoint deprecation is supported now (desirable for content-repo.* to make the message about moving to authed media very clear). --- Quotient/util.h | 8 ++++++++ gtad/gtad | 2 +- gtad/gtad.yaml | 23 ++++++++++++++++------- gtad/operation.h.mustache | 2 +- 4 files changed, 26 insertions(+), 9 deletions(-) diff --git a/Quotient/util.h b/Quotient/util.h index de8f0489b..b4b262e28 100644 --- a/Quotient/util.h +++ b/Quotient/util.h @@ -421,3 +421,11 @@ constexpr inline size_t mergeStruct(StructT& lhs, const StructT& rhs, const auto { return ((... + static_cast(merge(lhs.*fields, rhs.*fields)))); } + +// These are meant to eventually become separate classes derived from QString (or perhaps +// QByteArray?), with their own construction and validation logic; for now they are just aliases +// for QString to make numerous IDs at least semantically different in the code. + +using UserId = QString; +using RoomId = QString; +using EventId = QString; diff --git a/gtad/gtad b/gtad/gtad index 70d25002b..07a7a92cc 160000 --- a/gtad/gtad +++ b/gtad/gtad @@ -1 +1 @@ -Subproject commit 70d25002b4ac8063c01be159b0d0bddb7589972d +Subproject commit 07a7a92cc5ee9cbad8821a193459ca185cc9b9fa diff --git a/gtad/gtad.yaml b/gtad/gtad.yaml index 163ef6f99..8e4c2dbbf 100644 --- a/gtad/gtad.yaml +++ b/gtad/gtad.yaml @@ -1,7 +1,10 @@ analyzer: subst: - "%CLIENT_RELEASE_LABEL%": r0 - "%CLIENT_MAJOR_VERSION%": r0 + # Escaping open braces because GTAD always treats subst keys as regexes, unlike other places + '\{\{% boxes/note %}}': '\note' + '\{\{% boxes/warning %}}': '\warning' + '\{\{< changed-in v="([^ ]+)" >}}': '**(Changed in v$1)**' + '( +)\{\{% /boxes/[a-z]+ %}}\n': '' # Delete lines with the closing handlebar entirely identifiers: signed: signedData unsigned: unsignedData @@ -84,13 +87,16 @@ analyzer: - dateTime: type: QDateTime initializer: QDateTime::fromString("{{defaultValue}}") - - uri: + - uri: &Url type: QUrl initializer: QUrl::fromEncoded("{{defaultValue}}") + - mx-mxc-uri: *Url + - mx-user-id: UserId + - mx-room-id: RoomId + - mx-event-id: EventId - //: &QString type: QString initializer: QStringLiteral("{{defaultValue}}") - isString: - file: *ByteStream - +set: { avoidCopy: } +on: @@ -122,11 +128,11 @@ analyzer: - /(room|client)_event.yaml$/: RoomEvents - /event(_without_room_id)?.yaml$/: Events - //: "QVector<{{1}}>" - - map: # `additionalProperties` in OpenAPI + - map: # `patternProperties` and `additionalProperties` in OpenAPI - RoomState: - type: "std::unordered_map" + type: "std::unordered_map<{{1}}, {{2}}>" moveOnly: - - /.+/: "QHash" + - /.+/: "QHash<{{1}}, {{2}}>" - //: QVariantHash # QJsonObject?.. - variant: # A sequence `type` or a 'oneOf' group in OpenAPI - /^string,null|null,string$/: *QString @@ -183,6 +189,9 @@ mustache: initializer: '{{defaultValue}}' cjoin: '{{#hasMore}}, {{/hasMore}}' + maybeDeprecated: + '{{#deprecated?}}[[deprecated("Check the documentation for details")]] {{/deprecated?}}' + openOptional: "{{^required?}}{{#useOptional}}\ {{^defaultValue}}std::optional<{{/defaultValue}}\ diff --git a/gtad/operation.h.mustache b/gtad/operation.h.mustache index 1c7a105d5..64e30c092 100644 --- a/gtad/operation.h.mustache +++ b/gtad/operation.h.mustache @@ -18,7 +18,7 @@ namespace Quotient { //! \brief {{summary}}{{#description?}} //!{{#description}} //! {{_}}{{/description}}{{/description?}} -class QUOTIENT_API {{>titleCaseOperationId}}Job : public BaseJob { +class {{>maybeDeprecated}} QUOTIENT_API {{>titleCaseOperationId}}Job : public BaseJob { public: {{#models}}{{#model?}} // Inner data structures