From a1fedde8af87af8c6d930134209446b4a9dfccee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=B5=E3=81=81?= Date: Thu, 28 Mar 2024 17:39:50 +0900 Subject: [PATCH 1/5] add tweetDisplayType enum MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: ふぁ --- src/openapi/schemas/content.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/src/openapi/schemas/content.yaml b/src/openapi/schemas/content.yaml index 48f18ab..e1b2a08 100644 --- a/src/openapi/schemas/content.yaml +++ b/src/openapi/schemas/content.yaml @@ -197,6 +197,7 @@ components: $ref: "#/components/schemas/ContentItemType" # TimelineTweet tweetDisplayType: type: string + enum: [Tweet, SelfThread, MediaGrid, CondensedTweet] tweet_results: $ref: "#/components/schemas/ItemResult" socialContext: From 96b9e209d143fc454a5d3a47f2cf996098e08cb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=B5=E3=81=81?= Date: Thu, 28 Mar 2024 18:03:04 +0900 Subject: [PATCH 2/5] add Article MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: ふぁ --- src/openapi/schemas/tweet.yaml | 104 ++++++++++++++++++++++++++++++ src/openapi/schemas/typename.yaml | 1 + 2 files changed, 105 insertions(+) diff --git a/src/openapi/schemas/tweet.yaml b/src/openapi/schemas/tweet.yaml index f87deab..280cc1b 100644 --- a/src/openapi/schemas/tweet.yaml +++ b/src/openapi/schemas/tweet.yaml @@ -165,6 +165,8 @@ components: type: boolean author_community_relationship: $ref: "#/components/schemas/AuthorCommunityRelationship" + article: + $ref: "#/components/schemas/Article" TweetEditControl: properties: @@ -1312,3 +1314,105 @@ components: type: integer text: type: string + + Article: + required: + - "article_results" + properties: + article_results: + $ref: "#/components/schemas/ArticleResults" + + ArticleResults: + required: + - "result" + properties: + result: + $ref: "#/components/schemas/ArticleResult" + + ArticleResult: + required: + - "rest_id" + - "id" + - "title" + - "preview_text" + - "cover_media" + properties: + rest_id: + type: string + pattern: "^[0-9]+$" + id: + type: string + title: + type: string + preview_text: + type: string + cover_media: + $ref: "#/components/schemas/ArticleCoverMedia" + + ArticleCoverMedia: + required: + - "id" + - "media_key" + - "media_id" + - "media_info" + properties: + id: + type: string + media_key: + type: string + media_id: + type: string + pattern: "^[0-9]+$" + media_info: + $ref: "#/components/schemas/ArticleCoverMediaInfo" + + ArticleCoverMediaInfo: + required: + - "original_img_height" + - "original_img_width" + - "original_img_url" + - "color_info" + properties: + __typename: + $ref: "./typename.yaml#/components/schemas/TypeName" # ApiImage + original_img_height: + type: integer + original_img_width: + type: integer + original_img_url: + type: string + format: uri + color_info: + $ref: "#/components/schemas/ArticleCoverMediaColorInfo" + + ArticleCoverMediaColorInfo: + required: + - "palette" + properties: + palette: + type: array + items: + $ref: "#/components/schemas/ArticleCoverMediaColorInfoPalette" + + ArticleCoverMediaColorInfoPalette: + required: + - "percentage" + - "rgb" + properties: + percentage: + type: number + rgb: + $ref: "#/components/schemas/ArticleCoverMediaColorInfoPaletteRGB" + + ArticleCoverMediaColorInfoPaletteRGB: + required: + - "blue" + - "green" + - "red" + properties: + blue: + type: integer + green: + type: integer + red: + type: integer diff --git a/src/openapi/schemas/typename.yaml b/src/openapi/schemas/typename.yaml index c5a15c7..1b32c18 100644 --- a/src/openapi/schemas/typename.yaml +++ b/src/openapi/schemas/typename.yaml @@ -31,4 +31,5 @@ components: CommunityTweetPinActionUnavailable, CommunityInvitesUnavailable, CommunityJoinRequestsUnavailable, + ApiImage, ] From 2146afb4642e590131e089b676ff71cea5ea273a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=B5=E3=81=81?= Date: Thu, 28 Mar 2024 18:03:38 +0900 Subject: [PATCH 3/5] build MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: ふぁ --- dist/compatible/openapi-3.0.yaml | 102 ++++++++++++++++++ .../compatible_discriminator/openapi-3.0.yaml | 102 ++++++++++++++++++ dist/docs/openapi-3.0.yaml | 102 ++++++++++++++++++ 3 files changed, 306 insertions(+) diff --git a/dist/compatible/openapi-3.0.yaml b/dist/compatible/openapi-3.0.yaml index f19868e..09ac0d7 100644 --- a/dist/compatible/openapi-3.0.yaml +++ b/dist/compatible/openapi-3.0.yaml @@ -29,6 +29,100 @@ components: type: string required: - url + Article: + properties: + article_results: + $ref: '#/components/schemas/ArticleResults' + required: + - article_results + ArticleCoverMedia: + properties: + id: + type: string + media_id: + pattern: ^[0-9]+$ + type: string + media_info: + $ref: '#/components/schemas/ArticleCoverMediaInfo' + media_key: + type: string + required: + - id + - media_key + - media_id + - media_info + ArticleCoverMediaColorInfo: + properties: + palette: + items: + $ref: '#/components/schemas/ArticleCoverMediaColorInfoPalette' + type: array + required: + - palette + ArticleCoverMediaColorInfoPalette: + properties: + percentage: + type: number + rgb: + $ref: '#/components/schemas/ArticleCoverMediaColorInfoPaletteRGB' + required: + - percentage + - rgb + ArticleCoverMediaColorInfoPaletteRGB: + properties: + blue: + type: integer + green: + type: integer + red: + type: integer + required: + - blue + - green + - red + ArticleCoverMediaInfo: + properties: + __typename: + $ref: '#/components/schemas/TypeName' + color_info: + $ref: '#/components/schemas/ArticleCoverMediaColorInfo' + original_img_height: + type: integer + original_img_url: + format: uri + type: string + original_img_width: + type: integer + required: + - original_img_height + - original_img_width + - original_img_url + - color_info + ArticleResult: + properties: + cover_media: + $ref: '#/components/schemas/ArticleCoverMedia' + id: + type: string + preview_text: + type: string + rest_id: + pattern: ^[0-9]+$ + type: string + title: + type: string + required: + - rest_id + - id + - title + - preview_text + - cover_media + ArticleResults: + properties: + result: + $ref: '#/components/schemas/ArticleResult' + required: + - result AuthorCommunityRelationship: properties: community_results: @@ -1763,6 +1857,11 @@ components: socialContext: $ref: '#/components/schemas/SocialContextUnion' tweetDisplayType: + enum: + - Tweet + - SelfThread + - MediaGrid + - CondensedTweet type: string tweet_results: $ref: '#/components/schemas/ItemResult' @@ -1842,6 +1941,8 @@ components: properties: __typename: $ref: '#/components/schemas/TypeName' + article: + $ref: '#/components/schemas/Article' author_community_relationship: $ref: '#/components/schemas/AuthorCommunityRelationship' birdwatch_pivot: @@ -2352,6 +2453,7 @@ components: - CommunityTweetPinActionUnavailable - CommunityInvitesUnavailable - CommunityJoinRequestsUnavailable + - ApiImage type: string UnfavoriteTweet: properties: diff --git a/dist/compatible_discriminator/openapi-3.0.yaml b/dist/compatible_discriminator/openapi-3.0.yaml index fd12dea..6b9148b 100644 --- a/dist/compatible_discriminator/openapi-3.0.yaml +++ b/dist/compatible_discriminator/openapi-3.0.yaml @@ -29,6 +29,100 @@ components: type: string required: - url + Article: + properties: + article_results: + $ref: '#/components/schemas/ArticleResults' + required: + - article_results + ArticleCoverMedia: + properties: + id: + type: string + media_id: + pattern: ^[0-9]+$ + type: string + media_info: + $ref: '#/components/schemas/ArticleCoverMediaInfo' + media_key: + type: string + required: + - id + - media_key + - media_id + - media_info + ArticleCoverMediaColorInfo: + properties: + palette: + items: + $ref: '#/components/schemas/ArticleCoverMediaColorInfoPalette' + type: array + required: + - palette + ArticleCoverMediaColorInfoPalette: + properties: + percentage: + type: number + rgb: + $ref: '#/components/schemas/ArticleCoverMediaColorInfoPaletteRGB' + required: + - percentage + - rgb + ArticleCoverMediaColorInfoPaletteRGB: + properties: + blue: + type: integer + green: + type: integer + red: + type: integer + required: + - blue + - green + - red + ArticleCoverMediaInfo: + properties: + __typename: + $ref: '#/components/schemas/TypeName' + color_info: + $ref: '#/components/schemas/ArticleCoverMediaColorInfo' + original_img_height: + type: integer + original_img_url: + format: uri + type: string + original_img_width: + type: integer + required: + - original_img_height + - original_img_width + - original_img_url + - color_info + ArticleResult: + properties: + cover_media: + $ref: '#/components/schemas/ArticleCoverMedia' + id: + type: string + preview_text: + type: string + rest_id: + pattern: ^[0-9]+$ + type: string + title: + type: string + required: + - rest_id + - id + - title + - preview_text + - cover_media + ArticleResults: + properties: + result: + $ref: '#/components/schemas/ArticleResult' + required: + - result AuthorCommunityRelationship: properties: community_results: @@ -1763,6 +1857,11 @@ components: socialContext: $ref: '#/components/schemas/SocialContextUnion' tweetDisplayType: + enum: + - Tweet + - SelfThread + - MediaGrid + - CondensedTweet type: string tweet_results: $ref: '#/components/schemas/ItemResult' @@ -1842,6 +1941,8 @@ components: properties: __typename: $ref: '#/components/schemas/TypeName' + article: + $ref: '#/components/schemas/Article' author_community_relationship: $ref: '#/components/schemas/AuthorCommunityRelationship' birdwatch_pivot: @@ -2352,6 +2453,7 @@ components: - CommunityTweetPinActionUnavailable - CommunityInvitesUnavailable - CommunityJoinRequestsUnavailable + - ApiImage type: string UnfavoriteTweet: properties: diff --git a/dist/docs/openapi-3.0.yaml b/dist/docs/openapi-3.0.yaml index 532c39a..adcf344 100644 --- a/dist/docs/openapi-3.0.yaml +++ b/dist/docs/openapi-3.0.yaml @@ -29,6 +29,100 @@ components: type: string required: - url + Article: + properties: + article_results: + $ref: '#/components/schemas/ArticleResults' + required: + - article_results + ArticleCoverMedia: + properties: + id: + type: string + media_id: + pattern: ^[0-9]+$ + type: string + media_info: + $ref: '#/components/schemas/ArticleCoverMediaInfo' + media_key: + type: string + required: + - id + - media_key + - media_id + - media_info + ArticleCoverMediaColorInfo: + properties: + palette: + items: + $ref: '#/components/schemas/ArticleCoverMediaColorInfoPalette' + type: array + required: + - palette + ArticleCoverMediaColorInfoPalette: + properties: + percentage: + type: number + rgb: + $ref: '#/components/schemas/ArticleCoverMediaColorInfoPaletteRGB' + required: + - percentage + - rgb + ArticleCoverMediaColorInfoPaletteRGB: + properties: + blue: + type: integer + green: + type: integer + red: + type: integer + required: + - blue + - green + - red + ArticleCoverMediaInfo: + properties: + __typename: + $ref: '#/components/schemas/TypeName' + color_info: + $ref: '#/components/schemas/ArticleCoverMediaColorInfo' + original_img_height: + type: integer + original_img_url: + format: uri + type: string + original_img_width: + type: integer + required: + - original_img_height + - original_img_width + - original_img_url + - color_info + ArticleResult: + properties: + cover_media: + $ref: '#/components/schemas/ArticleCoverMedia' + id: + type: string + preview_text: + type: string + rest_id: + pattern: ^[0-9]+$ + type: string + title: + type: string + required: + - rest_id + - id + - title + - preview_text + - cover_media + ArticleResults: + properties: + result: + $ref: '#/components/schemas/ArticleResult' + required: + - result AuthorCommunityRelationship: properties: community_results: @@ -1763,6 +1857,11 @@ components: socialContext: $ref: '#/components/schemas/SocialContextUnion' tweetDisplayType: + enum: + - Tweet + - SelfThread + - MediaGrid + - CondensedTweet type: string tweet_results: $ref: '#/components/schemas/ItemResult' @@ -1842,6 +1941,8 @@ components: properties: __typename: $ref: '#/components/schemas/TypeName' + article: + $ref: '#/components/schemas/Article' author_community_relationship: $ref: '#/components/schemas/AuthorCommunityRelationship' birdwatch_pivot: @@ -2352,6 +2453,7 @@ components: - CommunityTweetPinActionUnavailable - CommunityInvitesUnavailable - CommunityJoinRequestsUnavailable + - ApiImage type: string UnfavoriteTweet: properties: From 47b1d611c3db9189a02f06909fac4a68d1678a15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=B5=E3=81=81?= Date: Thu, 28 Mar 2024 18:09:27 +0900 Subject: [PATCH 4/5] update 7.4.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: ふぁ --- .github/workflows/test-build.yaml | 2 +- .github/workflows/test-python.yaml | 2 +- .vscode/tasks.json | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test-build.yaml b/.github/workflows/test-build.yaml index 8415e4e..fb30b1a 100644 --- a/.github/workflows/test-build.yaml +++ b/.github/workflows/test-build.yaml @@ -39,7 +39,7 @@ jobs: - name: Get Openapi Generator run: | - wget https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.3.0/openapi-generator-cli-7.3.0.jar -O openapi-generator-cli.jar --no-verbose + wget https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.4.0/openapi-generator-cli-7.4.0.jar -O openapi-generator-cli.jar --no-verbose if: steps.openapi-generator-cache.outputs.cache-hit != 'true' # Python Setup diff --git a/.github/workflows/test-python.yaml b/.github/workflows/test-python.yaml index 0573b0a..bfa35b4 100644 --- a/.github/workflows/test-python.yaml +++ b/.github/workflows/test-python.yaml @@ -40,7 +40,7 @@ jobs: - name: Get Openapi Generator run: | - wget https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.3.0/openapi-generator-cli-7.3.0.jar -O openapi-generator-cli.jar --no-verbose + wget https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.4.0/openapi-generator-cli-7.4.0.jar -O openapi-generator-cli.jar --no-verbose if: steps.openapi-generator-cache.outputs.cache-hit != 'true' # Python Setup diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 575a290..01d82e5 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -32,14 +32,14 @@ "command": [ "python3 -m venv .venv;", ".venv/bin/python3 -m pip install -r requirements.txt;", - "wget https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.3.0/openapi-generator-cli-7.3.0.jar -O openapi-generator-cli.jar;" + "wget https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.4.0/openapi-generator-cli-7.4.0.jar -O openapi-generator-cli.jar;" ] }, "windows": { "command": [ "python -m venv .venv;", ".venv/Scripts/python -m pip install -r requirements.txt;", - "Invoke-WebRequest https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.3.0/openapi-generator-cli-7.3.0.jar -OutFile openapi-generator-cli.jar;" + "Invoke-WebRequest https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.4.0/openapi-generator-cli-7.4.0.jar -OutFile openapi-generator-cli.jar;" ] } } From ca2a7627f4d284e1a609634137ec6f765d9924cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=B5=E3=81=81?= Date: Thu, 28 Mar 2024 18:21:07 +0900 Subject: [PATCH 5/5] update enum MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: ふぁ --- test/python/test_serialize.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/python/test_serialize.py b/test/python/test_serialize.py index 6896df4..5dd7a67 100644 --- a/test/python/test_serialize.py +++ b/test/python/test_serialize.py @@ -9,7 +9,7 @@ import traceback import warnings from pathlib import Path -import aenum +from enum import Enum import openapi_client as pt warnings.filterwarnings("ignore") @@ -84,9 +84,9 @@ def match_rate_zero(a, b, base, key): def match_rate(a, b, base, key=""): - if isinstance(a, aenum.Enum): + if isinstance(a, Enum): a = a.value - if isinstance(b, aenum.Enum): + if isinstance(b, Enum): b = b.value if a is None and b is False: return 1