Skip to content

Commit

Permalink
Merge pull request #11802 from nextcloud/bugfix/noid/better-parameter…
Browse files Browse the repository at this point in the history
…-types

fix(openapi): Provide better message parameter definitions
  • Loading branch information
nickvergessen authored Mar 14, 2024
2 parents b197842 + 7d46ee5 commit 380f456
Show file tree
Hide file tree
Showing 9 changed files with 544 additions and 58 deletions.
30 changes: 28 additions & 2 deletions lib/ResponseDefinitions.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,32 @@
* statusMessage: ?string,
* }
*
* @psalm-type TalkRichObjectParameter = array{
* type: string,
* id: string,
* name: string,
* server?: string,
* link?: string,
* 'call-type'?: 'one2one'|'group'|'public',
* 'icon-url'?: string,
* 'message-id'?: string,
* boardname?: string,
* stackname?: string,
* size?: string,
* path?: string,
* mimetype?: string,
* 'preview-available'?: 'yes'|'no',
* mtime?: string,
* latitude?: string,
* longitude?: string,
* description?: string,
* thumb?: string,
* website?: string,
* visibility?: '0'|'1',
* assignable?: '0'|'1',
* conversation?: string,
* }
*
* @psalm-type TalkChatMessage = array{
* actorDisplayName: string,
* actorId: string,
Expand All @@ -77,7 +103,7 @@
* isReplyable: bool,
* markdown: bool,
* message: string,
* messageParameters: array<string, array<string, mixed>>,
* messageParameters: array<string, TalkRichObjectParameter>,
* messageType: string,
* reactions: array<string, integer>|\stdClass,
* referenceId: string,
Expand All @@ -97,7 +123,7 @@
* actorType: string,
* expirationTimestamp: int,
* message: string,
* messageParameters: array<string, array<string, mixed>>,
* messageParameters: array<string, TalkRichObjectParameter>,
* messageType: string,
* systemMessage: string,
* }
Expand Down
106 changes: 98 additions & 8 deletions openapi-backend-sipbridge.json
Original file line number Diff line number Diff line change
Expand Up @@ -263,10 +263,7 @@
"messageParameters": {
"type": "object",
"additionalProperties": {
"type": "object",
"additionalProperties": {
"type": "object"
}
"$ref": "#/components/schemas/RichObjectParameter"
}
},
"messageType": {
Expand Down Expand Up @@ -353,6 +350,102 @@
}
]
},
"RichObjectParameter": {
"type": "object",
"required": [
"type",
"id",
"name"
],
"properties": {
"type": {
"type": "string"
},
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"server": {
"type": "string"
},
"link": {
"type": "string"
},
"call-type": {
"type": "string",
"enum": [
"one2one",
"group",
"public"
]
},
"icon-url": {
"type": "string"
},
"message-id": {
"type": "string"
},
"boardname": {
"type": "string"
},
"stackname": {
"type": "string"
},
"size": {
"type": "string"
},
"path": {
"type": "string"
},
"mimetype": {
"type": "string"
},
"preview-available": {
"type": "string",
"enum": [
"yes",
"no"
]
},
"mtime": {
"type": "string"
},
"latitude": {
"type": "string"
},
"longitude": {
"type": "string"
},
"description": {
"type": "string"
},
"thumb": {
"type": "string"
},
"website": {
"type": "string"
},
"visibility": {
"type": "string",
"enum": [
"0",
"1"
]
},
"assignable": {
"type": "string",
"enum": [
"0",
"1"
]
},
"conversation": {
"type": "string"
}
}
},
"Room": {
"type": "object",
"required": [
Expand Down Expand Up @@ -655,10 +748,7 @@
"messageParameters": {
"type": "object",
"additionalProperties": {
"type": "object",
"additionalProperties": {
"type": "object"
}
"$ref": "#/components/schemas/RichObjectParameter"
}
},
"messageType": {
Expand Down
106 changes: 98 additions & 8 deletions openapi-federation.json
Original file line number Diff line number Diff line change
Expand Up @@ -263,10 +263,7 @@
"messageParameters": {
"type": "object",
"additionalProperties": {
"type": "object",
"additionalProperties": {
"type": "object"
}
"$ref": "#/components/schemas/RichObjectParameter"
}
},
"messageType": {
Expand Down Expand Up @@ -407,6 +404,102 @@
}
]
},
"RichObjectParameter": {
"type": "object",
"required": [
"type",
"id",
"name"
],
"properties": {
"type": {
"type": "string"
},
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"server": {
"type": "string"
},
"link": {
"type": "string"
},
"call-type": {
"type": "string",
"enum": [
"one2one",
"group",
"public"
]
},
"icon-url": {
"type": "string"
},
"message-id": {
"type": "string"
},
"boardname": {
"type": "string"
},
"stackname": {
"type": "string"
},
"size": {
"type": "string"
},
"path": {
"type": "string"
},
"mimetype": {
"type": "string"
},
"preview-available": {
"type": "string",
"enum": [
"yes",
"no"
]
},
"mtime": {
"type": "string"
},
"latitude": {
"type": "string"
},
"longitude": {
"type": "string"
},
"description": {
"type": "string"
},
"thumb": {
"type": "string"
},
"website": {
"type": "string"
},
"visibility": {
"type": "string",
"enum": [
"0",
"1"
]
},
"assignable": {
"type": "string",
"enum": [
"0",
"1"
]
},
"conversation": {
"type": "string"
}
}
},
"Room": {
"type": "object",
"required": [
Expand Down Expand Up @@ -709,10 +802,7 @@
"messageParameters": {
"type": "object",
"additionalProperties": {
"type": "object",
"additionalProperties": {
"type": "object"
}
"$ref": "#/components/schemas/RichObjectParameter"
}
},
"messageType": {
Expand Down
Loading

0 comments on commit 380f456

Please sign in to comment.