Skip to content

Commit

Permalink
GTAD: update to support Matrix 1.11
Browse files Browse the repository at this point in the history
- 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 matrix-org/matrix-spec#1873)
- endpoint deprecation is supported now (desirable for content-repo.*
  to make the message about moving to authed media very clear).
  • Loading branch information
KitsuneRal committed Jun 30, 2024
1 parent ff003a9 commit 3a037ae
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 9 deletions.
8 changes: 8 additions & 0 deletions Quotient/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -421,3 +421,11 @@ constexpr inline size_t mergeStruct(StructT& lhs, const StructT& rhs, const auto
{
return ((... + static_cast<size_t>(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;
2 changes: 1 addition & 1 deletion gtad/gtad
Submodule gtad updated 9 files
+10 −11 CMakeLists.txt
+59 −33 README.md
+65 −37 analyzer.cpp
+1 −0 analyzer.h
+6 −6 model.cpp
+13 −10 model.h
+16 −10 printer.cpp
+1 −0 printer.h
+2 −3 yaml.h
23 changes: 16 additions & 7 deletions gtad/gtad.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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<QString, {{1}}>"
type: "std::unordered_map<{{1}}, {{2}}>"
moveOnly:
- /.+/: "QHash<QString, {{1}}>"
- /.+/: "QHash<{{1}}, {{2}}>"
- //: QVariantHash # QJsonObject?..
- variant: # A sequence `type` or a 'oneOf' group in OpenAPI
- /^string,null|null,string$/: *QString
Expand Down Expand Up @@ -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}}\
Expand Down
2 changes: 1 addition & 1 deletion gtad/operation.h.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3a037ae

Please sign in to comment.