From cee095e948899d5fd76247fbcfa11859d6707942 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=B5=E3=81=81?= Date: Sun, 30 Jul 2023 19:43:04 +0900 Subject: [PATCH] fix #22, update additionalProperties MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: ふぁ --- src/openapi/paths/bookmarks.yaml | 4 +- src/openapi/paths/profile.yaml | 5 +- src/openapi/schemas/content.yaml | 30 +++++---- src/openapi/schemas/error.yaml | 99 ++++++++++++++++++++++++++++ src/openapi/schemas/instruction.yaml | 11 ++-- src/openapi/schemas/timeline.yaml | 6 +- src/openapi/schemas/tweet.yaml | 23 ++++--- src/openapi/schemas/user.yaml | 11 ++-- 8 files changed, 157 insertions(+), 32 deletions(-) create mode 100644 src/openapi/schemas/error.yaml diff --git a/src/openapi/paths/bookmarks.yaml b/src/openapi/paths/bookmarks.yaml index 6890e9c..160b40d 100644 --- a/src/openapi/paths/bookmarks.yaml +++ b/src/openapi/paths/bookmarks.yaml @@ -14,7 +14,9 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/BookmarksResponse" + oneOf: + - $ref: "#/components/schemas/BookmarksResponse" + - $ref: "./../schemas/error.yaml#/components/schemas/Errors" tags: - "tweet" diff --git a/src/openapi/paths/profile.yaml b/src/openapi/paths/profile.yaml index faf9b80..b26453c 100644 --- a/src/openapi/paths/profile.yaml +++ b/src/openapi/paths/profile.yaml @@ -39,7 +39,7 @@ components: properties: id: type: string - # pattern: "^[0-9a-zA-Z]+$" + pattern: "^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)?$" # base64 result: $ref: "#/components/schemas/UserResultByScreenNameResult" @@ -59,7 +59,8 @@ components: legacy: $ref: "#/components/schemas/UserResultByScreenNameLegacy" profilemodules: - type: object # todo + type: object + additionalProperties: true # todo rest_id: type: string pattern: "^[0-9]+$" diff --git a/src/openapi/schemas/content.yaml b/src/openapi/schemas/content.yaml index 0329367..929e6d9 100644 --- a/src/openapi/schemas/content.yaml +++ b/src/openapi/schemas/content.yaml @@ -36,9 +36,11 @@ components: itemContent: $ref: "#/components/schemas/ItemContentUnion" clientEventInfo: - type: object # todo + type: object + additionalProperties: true # todo feedbackInfo: - type: object # todo + type: object + additionalProperties: true # todo TimelineTimelineModule: required: @@ -50,7 +52,6 @@ components: properties: __typename: type: string - value: TimelineTimelineModule # $ref: "./typename.yaml#/components/schemas/TypeName" # TimelineTimelineModule entryType: $ref: "#/components/schemas/ContentEntryType" # TimelineTimelineCursor @@ -61,12 +62,15 @@ components: items: $ref: "#/components/schemas/ModuleItem" footer: - type: object # todo + type: object + additionalProperties: true # todo header: - type: object # todo + type: object + additionalProperties: true # todo clientEventInfo: - type: object # todo + type: object + additionalProperties: true # todo TimelineTimelineCursor: required: @@ -95,7 +99,7 @@ components: properties: entryId: type: string - # pattern: '^[a-z\-]+[0-9]+$' + pattern: "^(([a-z]+|[0-9]+|[0-9a-f]+)(-|$))+" item: $ref: "#/components/schemas/ModuleEntry" @@ -105,7 +109,8 @@ components: - "itemContent" properties: clientEventInfo: - type: object # todo + type: object + additionalProperties: true # todo itemContent: $ref: "#/components/schemas/ItemContentUnion" @@ -157,7 +162,8 @@ components: SocialContext: $ref: "#/components/schemas/SocialContext" promotedMetadata: - type: object # todo + type: object + additionalProperties: true # todo TimelineUser: required: @@ -197,12 +203,14 @@ components: type: type: string # enum - TimelinePrompt: # todo + TimelinePrompt: properties: __typename: $ref: "./typename.yaml#/components/schemas/TypeName" # TimelinePrompt + additionalProperties: true # todo - TimelineMessagePrompt: # todo + TimelineMessagePrompt: properties: __typename: $ref: "./typename.yaml#/components/schemas/TypeName" # TimelineMessagePrompt + additionalProperties: true # todo diff --git a/src/openapi/schemas/error.yaml b/src/openapi/schemas/error.yaml new file mode 100644 index 0000000..4deed22 --- /dev/null +++ b/src/openapi/schemas/error.yaml @@ -0,0 +1,99 @@ +openapi: 3.0.3 +info: + title: Twitter OpenAPI + version: 0.0.1 + +paths: {} +components: + schemas: + Errors: + type: object + required: + - errors + properties: + errors: + type: array + items: + $ref: "#/components/schemas/Error" + + Error: + type: object + required: + - message + - locations + - path + - extensions + - code + - kind + - name + - source + - retry_after + - tracing + properties: + message: + type: string + locations: + type: array + items: + $ref: "#/components/schemas/Location" + path: + type: array + items: + type: string + extensions: + $ref: "#/components/schemas/ErrorExtensions" + code: + type: integer + kind: + type: string + name: + type: string + source: + type: string + retry_after: + type: integer + tracing: + $ref: "#/components/schemas/Tracing" + + Location: + type: object + required: + - line + - column + properties: + line: + type: integer + column: + type: integer + + ErrorExtensions: + type: object + required: + - name + - source + - retry_after + - code + - kind + - tracing + properties: + name: + type: string + source: + type: string + retry_after: + type: integer + code: + type: integer + kind: + type: string + tracing: + $ref: "#/components/schemas/Tracing" + + Tracing: + type: object + required: + - trace_id + properties: + trace_id: + type: string + pattern: "^[0-9a-f]{16}$" diff --git a/src/openapi/schemas/instruction.yaml b/src/openapi/schemas/instruction.yaml index 6057b96..881f9dd 100644 --- a/src/openapi/schemas/instruction.yaml +++ b/src/openapi/schemas/instruction.yaml @@ -125,11 +125,14 @@ components: entities: type: array items: - type: object # todo + type: object + additionalProperties: true # todo iconDisplayInfo: - type: object # todo + type: object + additionalProperties: true # todo colorConfig: - type: object # todo + type: object + additionalProperties: true # todo displayLocation: type: string enum: [Top] # which else? @@ -155,7 +158,7 @@ components: $ref: "./content.yaml#/components/schemas/ContentUnion" entryId: type: string - # pattern: '^[a-z\-]+[0-9]+$' + pattern: "^(([a-z]+|[0-9]+|[0-9a-f]+)(-|$))+" sortIndex: type: string pattern: "[0-9]+$" diff --git a/src/openapi/schemas/timeline.yaml b/src/openapi/schemas/timeline.yaml index 0ec75ba..2592ac8 100644 --- a/src/openapi/schemas/timeline.yaml +++ b/src/openapi/schemas/timeline.yaml @@ -22,6 +22,8 @@ components: items: $ref: "./../schemas/instruction.yaml#/components/schemas/InstructionUnion" metadata: - type: object # todo + type: object + additionalProperties: true # todo responseObjects: - type: object # todo + type: object + additionalProperties: true # todo diff --git a/src/openapi/schemas/tweet.yaml b/src/openapi/schemas/tweet.yaml index 03417da..baf63f8 100644 --- a/src/openapi/schemas/tweet.yaml +++ b/src/openapi/schemas/tweet.yaml @@ -33,7 +33,7 @@ components: properties: __typename: $ref: "./typename.yaml#/components/schemas/TypeName" # TweetWithVisibilityResults - # todo + additionalProperties: true # todo Tweet: required: @@ -93,7 +93,8 @@ components: type: type: string unmention_data: - type: object # todo + type: object + additionalProperties: true # todo edit_control: type: object properties: @@ -241,11 +242,14 @@ components: $ref: "#/components/schemas/Media" Hashtag: - type: object # todo + type: object + additionalProperties: true # todo Symbol: - type: object # todo + type: object + additionalProperties: true # todo UserMention: - type: object # todo + type: object + additionalProperties: true # todo Url: type: object required: @@ -310,7 +314,8 @@ components: type: type: string # enum sizes: - type: object # todo + type: object + additionalProperties: true # todo original_info: type: object properties: @@ -321,9 +326,11 @@ components: focus_rects: type: array items: - type: object # todo + type: object + additionalProperties: true # todo media_key: type: string pattern: "^[0-9]+_[0-9]+$" ext_media_availability: - type: object # todo + type: object + additionalProperties: true # todo diff --git a/src/openapi/schemas/user.yaml b/src/openapi/schemas/user.yaml index 5b5b078..1349108 100644 --- a/src/openapi/schemas/user.yaml +++ b/src/openapi/schemas/user.yaml @@ -35,7 +35,8 @@ components: __typename: $ref: "./typename.yaml#/components/schemas/TypeName" # User affiliates_highlighted_label: - type: object # todo + type: object + additionalProperties: true # todo has_graduated_access: type: boolean has_nft_avatar: @@ -43,7 +44,7 @@ components: default: false id: type: string - # pattern: '^[a-z\-]+[0-9]+$' + pattern: "^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)?$" # base64 is_blue_verified: type: boolean default: false @@ -53,7 +54,8 @@ components: type: string pattern: "^[0-9]+$" business_account: - type: object # todo + type: object + additionalProperties: true # todo super_follow_eligible: type: boolean default: false @@ -126,7 +128,8 @@ components: description: type: string entities: - type: object # todo + type: object + additionalProperties: true # todo fast_followers_count: type: integer favourites_count: