diff options
Diffstat (limited to 'gtad/gtad.yaml')
-rw-r--r-- | gtad/gtad.yaml | 102 |
1 files changed, 69 insertions, 33 deletions
diff --git a/gtad/gtad.yaml b/gtad/gtad.yaml index 51f9e26b..045f5f35 100644 --- a/gtad/gtad.yaml +++ b/gtad/gtad.yaml @@ -15,6 +15,11 @@ analyzer: m.change_password: changePassword m.room_versions: roomVersions AuthenticationData/additionalProperties: authInfo + /\b(Location|Protocol|User)$/: 'ThirdParty$&' + # These parameters are deprecated and unused in Quotient; so drop them + login>/user: "" + login>/medium: "" + login>/address: "" # Structure inside `types`: # - swaggerType: <targetTypeSpec> @@ -31,8 +36,7 @@ analyzer: types: - +set: &UseOmittable useOmittable: - imports: [ '"converters.h"' ] - omittedValue: 'none' # See `none` in converters.h + omittedValue: 'none' # Quotient::none in lib/util.h +on: - integer: - int64: qint64 @@ -52,11 +56,9 @@ analyzer: - date: type: QDate initializer: QDate::fromString("{{defaultValue}}") - imports: <QtCore/QDate> - dateTime: type: QDateTime initializer: QDateTime::fromString("{{defaultValue}}") - imports: <QtCore/QDateTime> - //: &QString type: QString initializer: QStringLiteral("{{defaultValue}}") @@ -64,7 +66,7 @@ analyzer: - file: *ByteStream - +set: { avoidCopy: } +on: - - object: &QJsonObject { type: QJsonObject, imports: <QtCore/QJsonObject> } + - object: &QJsonObject { type: QJsonObject } - $ref: - +set: { moveOnly: } +on: @@ -74,10 +76,16 @@ analyzer: { type: RoomEventPtr, imports: '"events/eventloader.h"' } - /event.yaml$/: { type: EventPtr, imports: '"events/eventloader.h"' } - - /m\.room\.member$/: pass # This $ref is only used in an array, see below + - /m\.room\.member$/: void # Skip resolving; see EventsArray<> below + - '/^(\./)?definitions/request_email_validation.yaml$/': + title: EmailValidationData + - '/^(\./)?definitions/request_msisdn_validation.yaml$/': + title: MsisdnValidationData + - /_filter.yaml$/: # Event/RoomEventFilters do NOT need Omittable<> - //: *UseOmittable # Also apply "avoidCopy" to all other ref'ed types - - schema: # Properties of inline structure definitions - - TurnServerCredentials: *QJsonObject # Because it's used as is + - schema: + - getTurnServer<: *QJsonObject # It's used as an opaque JSON object + - RoomFilter: # A structure inside Filter, same story as with other filters - //: *UseOmittable - array: - string: QStringList @@ -86,27 +94,23 @@ analyzer: - /^Notification|Result$/: type: "std::vector<{{1}}>" imports: '"events/eventloader.h"' - - /m\.room\.member$/: + - /m\.room\.member$/: # Only used in an array (see also above) type: "EventsArray<RoomMemberEvent>" imports: '"events/roommemberevent.h"' - /state_event.yaml$/: StateEvents - /room_event.yaml$/: RoomEvents - /event.yaml$/: Events - - //: { type: "QVector<{{1}}>", imports: <QtCore/QVector> } + - //: "QVector<{{1}}>" - map: # `additionalProperties` in OpenAPI - RoomState: type: "UnorderedMap<QString, {{1}}>" moveOnly: - imports: '"util.h"' - /.+/: type: "QHash<QString, {{1}}>" - imports: <QtCore/QHash> - - //: - type: QVariantHash - imports: <QtCore/QVariant> + - //: QVariantHash - variant: # A sequence `type` (multitype) in OpenAPI - /^string,null|null,string$/: *QString - - //: { type: QVariant, imports: <QtCore/QVariant> } + - //: QVariant #operations: @@ -127,43 +131,75 @@ mustache: initializer: '{{defaultValue}}' cjoin: '{{#hasMore}}, {{/hasMore}}' - openOmittable: "{{^required?}}{{#useOmittable}}{{^defaultValue}}Omittable<{{/defaultValue}}{{/useOmittable}}{{/required?}}" - closeOmittable: "{{^required?}}{{#useOmittable}}{{^defaultValue}}>{{/defaultValue}}{{/useOmittable}}{{/required?}}" + openOmittable: + "{{^required?}}{{#useOmittable}}\ + {{^defaultValue}}Omittable<{{/defaultValue}}\ + {{/useOmittable}}{{/required?}}" + closeOmittable: + "{{^required?}}{{#useOmittable}}\ + {{^defaultValue}}>{{/defaultValue}}\ + {{/useOmittable}}{{/required?}}" maybeOmittableType: "{{>openOmittable}}{{dataType.name}}{{>closeOmittable}}" - qualifiedMaybeOmittableType: "{{>openOmittable}}{{dataType.qualifiedName}}{{>closeOmittable}}" + qualifiedMaybeOmittableType: + "{{>openOmittable}}{{dataType.qualifiedName}}{{>closeOmittable}}" - maybeCrefType: "{{#avoidCopy}}const {{/avoidCopy}}{{>maybeOmittableType}}{{#avoidCopy}}&{{/avoidCopy}}{{#moveOnly}}&&{{/moveOnly}}" + ref: "{{#avoidCopy}}&{{/avoidCopy}}{{#moveOnly}}&&{{/moveOnly}}" + maybeCrefType: + "{{#avoidCopy}}const {{/avoidCopy}}{{>maybeOmittableType}}{{>ref}}" qualifiedMaybeCrefType: - "{{#avoidCopy}}const {{/avoidCopy}}{{>qualifiedMaybeOmittableType}}{{#avoidCopy}}&{{/avoidCopy}}{{#moveOnly}}&&{{/moveOnly}}" + "{{#avoidCopy}}const {{/avoidCopy}}{{>qualifiedMaybeOmittableType}}{{>ref}}" - maybeCrefJsonObject: "{{^propertyMap}}const QJsonObject&{{/propertyMap}}{{#propertyMap}}QJsonObject{{/propertyMap}}" - takeOrValue: "{{#propertyMap}}take{{/propertyMap}}{{^propertyMap}}value{{/propertyMap}}" + maybeCrefJsonObject: + "{{^propertyMap}}const QJsonObject&{{/propertyMap}}\ + {{#propertyMap}}QJsonObject{{/propertyMap}}" - initializeDefaultValue: "{{#defaultValue}}{{>initializer}}{{/defaultValue}}{{^defaultValue}}{{>omittedValue}}{{/defaultValue}}" - joinedParamDecl: '{{>maybeCrefType}} {{paramName}}{{^required?}} = {{>initializeDefaultValue}}{{/required?}}{{>cjoin}}' - joinedParamDef: '{{>maybeCrefType}} {{paramName}}{{>cjoin}}' - passQueryParams: '{{#queryParams}}{{paramName}}{{>cjoin}}{{/queryParams}}' + takeOrValue: + "{{#propertyMap}}take{{/propertyMap}}{{^propertyMap}}value{{/propertyMap}}" + takeOrLoad: "{{#moveOnly}}take{{/moveOnly}}{{^moveOnly}}load{{/moveOnly}}" + + initializeDefaultValue: + "{{#defaultValue}}{{>initializer}}{{/defaultValue}}\ + {{^defaultValue}}{{>omittedValue}}{{/defaultValue}}" + + # No inner indents in folded values! + + joinedParamDecl: >- + {{>maybeCrefType}} {{paramName}} + {{^required?}} = {{>initializeDefaultValue}}{{/required?}}{{>cjoin}} + joinedParamDef: "{{>maybeCrefType}} {{paramName}}{{>cjoin}}" + + passPathAndMaybeQuery: >- + QStringLiteral("{{basePathWithoutHost}}") + {{#pathParts}} % {{_}}{{/pathParts}}{{#queryParams?}}, + queryTo{{camelCaseOperationId}}( + {{#queryParams}}{{paramName}}{{>cjoin}}{{/queryParams}}){{/queryParams?}} + + nonInlineResponseSignature: |- + {{>docCommentShort}} + {{>maybeOmittableType}} {{paramName}}(){{^moveOnly}} const{{/moveOnly}} # Doc-comment blocks. Comment indent is managed by clang-format # (without clang-format there'd have to be a separate partial definition - # for each indent...) + # for each indent...) but we take care of line breaks to maintain + # some sanity even before clang-format - # For structures that are not supposed to have a summary (e.g., JSON schema) + # This is for structures that don't expect a summary (e.g., JSON schema) docCommentShort: |- {{#description}} /// {{_}}{{/description}} + # For structures with the summary, a common partial for summary is here; + # the main part is different in different places docCommentSummary: |- {{#summary}} \brief {{summary}} *{{/summary}} templates: data: - .h: "{{>template.h.mustache}}" - .cpp: "{{>template.cpp.mustache}}" + .h: "{{>data.h.mustache}}" api: - .h: "{{>template.h.mustache}}" - .cpp: "{{>template.cpp.mustache}}" + .h: "{{>operation.h.mustache}}" + .cpp: "{{>operation.cpp.mustache}}" #outFilesList: apifiles.txt |