From 2fdca5a995621d40478b73d06aefdf5507dffbd6 Mon Sep 17 00:00:00 2001 From: Mark Haines Date: Mon, 7 Nov 2016 10:50:52 +0000 Subject: [PATCH] Add a thumbnail_info common schema, deduplicate m.room.avatar and m.room.message#m.image --- .../msgtype_infos/image_info.yaml | 9 +++++++ .../msgtype_infos/thumbnail_info.yaml | 16 +++++++++++++ event-schemas/schema/m.room.avatar | 9 ------- event-schemas/schema/m.room.message#m.file | 4 ++-- event-schemas/schema/m.room.message#m.image | 24 ++----------------- .../schema/m.room.message#m.location | 4 ++-- event-schemas/schema/m.room.message#m.video | 4 ++-- 7 files changed, 33 insertions(+), 37 deletions(-) create mode 100644 event-schemas/schema/core-event-schema/msgtype_infos/thumbnail_info.yaml diff --git a/event-schemas/schema/core-event-schema/msgtype_infos/image_info.yaml b/event-schemas/schema/core-event-schema/msgtype_infos/image_info.yaml index 7ef7a86f..6d72f223 100644 --- a/event-schemas/schema/core-event-schema/msgtype_infos/image_info.yaml +++ b/event-schemas/schema/core-event-schema/msgtype_infos/image_info.yaml @@ -13,4 +13,13 @@ properties: w: description: The width of the image in pixels. type: integer + thumbnail_url: + desciption: The URL to a thumbnail of the image. + type: string + thumbnail_info: + allOf: + - $ref: core-event-schema/msgtype_infos/thumbnail_info.yaml + description: Metadata about the image referred to in ``thumbnail_url``. + title: ThumbnailInfo + type: object title: ImageInfo diff --git a/event-schemas/schema/core-event-schema/msgtype_infos/thumbnail_info.yaml b/event-schemas/schema/core-event-schema/msgtype_infos/thumbnail_info.yaml new file mode 100644 index 00000000..1daea3fc --- /dev/null +++ b/event-schemas/schema/core-event-schema/msgtype_infos/thumbnail_info.yaml @@ -0,0 +1,16 @@ +$schema: http://json-schema.org/draft-04/schema# +description: Metadata about a thumbnail image. +properties: + h: + description: The height of the image in pixels. + type: integer + mimetype: + description: The mimetype of the image, e.g. ``image/jpeg``. + type: string + size: + description: Size of the image in bytes. + type: integer + w: + description: The width of the image in pixels. + type: integer +title: ThumbnailInfo diff --git a/event-schemas/schema/m.room.avatar b/event-schemas/schema/m.room.avatar index f99ae285..94107641 100644 --- a/event-schemas/schema/m.room.avatar +++ b/event-schemas/schema/m.room.avatar @@ -11,15 +11,6 @@ properties: description: Metadata about the image referred to in ``url``. title: ImageInfo type: object - thumbnail_info: - allOf: - - $ref: core-event-schema/msgtype_infos/image_info.yaml - description: Metadata about the image referred to in ``thumbnail_url``. - title: ImageInfo - type: object - thumbnail_url: - description: The URL to the thumbnail of the image. - type: string url: description: The URL to the image. type: string diff --git a/event-schemas/schema/m.room.message#m.file b/event-schemas/schema/m.room.message#m.file index 68a355cc..84dc2041 100644 --- a/event-schemas/schema/m.room.message#m.file +++ b/event-schemas/schema/m.room.message#m.file @@ -22,9 +22,9 @@ properties: type: integer thumbnail_info: allOf: - - $ref: core-event-schema/msgtype_infos/image_info.yaml + - $ref: core-event-schema/msgtype_infos/thumbnail_info.yaml description: Metadata about the image referred to in ``thumbnail_url``. - title: ImageInfo + title: ThumbnailInfo type: object thumbnail_url: description: The URL to the thumbnail of the file. diff --git a/event-schemas/schema/m.room.message#m.image b/event-schemas/schema/m.room.message#m.image index 26fb0ee4..24857d94 100644 --- a/event-schemas/schema/m.room.message#m.image +++ b/event-schemas/schema/m.room.message#m.image @@ -9,29 +9,9 @@ properties: description: "A textual representation of the image. This could be the alt text of the image, the filename of the image, or some kind of content description for accessibility e.g. 'image attachment'." type: string info: + allOf: + - $ref: core-event-schema/msgtype_infos/image_info.yaml description: Metadata about the image referred to in ``url``. - properties: - h: - description: The height of the image in pixels. - type: integer - mimetype: - description: 'The mimetype of the image, e.g. ``image/jpeg``.' - type: string - size: - description: Size of the image in bytes. - type: integer - w: - description: The width of the image in pixels. - type: integer - thumbnail_info: - allOf: - - $ref: core-event-schema/msgtype_infos/image_info.yaml - description: Metadata about the image referred to in ``thumbnail_url``. - title: ImageInfo - type: object - thumbnail_url: - description: The URL to the thumbnail of the image. - type: string title: ImageInfo type: object msgtype: diff --git a/event-schemas/schema/m.room.message#m.location b/event-schemas/schema/m.room.message#m.location index 14ee97fb..150c3924 100644 --- a/event-schemas/schema/m.room.message#m.location +++ b/event-schemas/schema/m.room.message#m.location @@ -20,8 +20,8 @@ properties: properties: thumbnail_info: allOf: - - $ref: core-event-schema/msgtype_infos/image_info.yaml - title: ImageInfo + - $ref: core-event-schema/msgtype_infos/thumbnail_info.yaml + title: ThumbnailInfo type: object thumbnail_url: description: The URL to a thumbnail of the location being represented. diff --git a/event-schemas/schema/m.room.message#m.video b/event-schemas/schema/m.room.message#m.video index 09753965..6f520ac2 100644 --- a/event-schemas/schema/m.room.message#m.video +++ b/event-schemas/schema/m.room.message#m.video @@ -25,8 +25,8 @@ properties: type: integer thumbnail_info: allOf: - - $ref: core-event-schema/msgtype_infos/image_info.yaml - title: ImageInfo + - $ref: core-event-schema/msgtype_infos/thumbnail_info.yaml + title: ThumbnailInfo type: object thumbnail_url: description: The URL to a thumbnail of the video clip.