1
Fork 0
mirror of https://github.com/thegeneralist01/twitter-openapi synced 2026-01-11 23:50:26 +01:00

fix error schema

Signed-off-by: ふぁ <yuki@yuki0311.com>
This commit is contained in:
ふぁ 2024-09-29 18:08:58 +09:00
parent 162ad96a13
commit 28e49c7ddb
No known key found for this signature in database
GPG key ID: 83A8A5E74872A8AA
9 changed files with 90 additions and 199 deletions

View file

@ -4,22 +4,17 @@ info:
version: 0.0.1
paths: {}
components:
schemas:
ErrorResponse:
Errors:
type: object
required:
- errors
- data
properties:
errors:
$ref: "#/components/schemas/Errors"
Errors:
type: array
items:
$ref: "#/components/schemas/Error"
type: array
items:
$ref: "#/components/schemas/Error"
Error:
type: object
@ -32,7 +27,6 @@ components:
- kind
- name
- source
- retry_after
- tracing
properties:
message:
@ -46,7 +40,7 @@ components:
items:
type: string
extensions:
$ref: "#/components/schemas/Extensions"
$ref: "#/components/schemas/ErrorExtensions"
code:
type: integer
kind:
@ -71,7 +65,7 @@ components:
column:
type: integer
Extensions:
ErrorExtensions:
type: object
required:
- name
@ -84,6 +78,8 @@ components:
type: string
source:
type: string
retry_after:
type: integer
code:
type: integer
kind:
@ -98,3 +94,4 @@ components:
properties:
trace_id:
type: string
pattern: "^[0-9a-f]{16}$"

View file

@ -230,7 +230,7 @@ components:
ItemResult:
properties:
__typename:
$ref: "./typename.yaml#/components/schemas/TypeName" # null | TimelineTweet
$ref: "./typename.yaml#/components/schemas/TypeName" # null | TimelineTweet | TweetUnavailable
result:
$ref: "./tweet.yaml#/components/schemas/TweetUnion"

View file

@ -1,99 +0,0 @@
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}$"

View file

@ -12,12 +12,14 @@ components:
- $ref: "#/components/schemas/Tweet"
- $ref: "#/components/schemas/TweetWithVisibilityResults"
- $ref: "#/components/schemas/TweetTombstone"
- $ref: "#/components/schemas/TweetUnavailable"
discriminator:
propertyName: __typename
mapping": # deprecated
Tweet: "#/components/schemas/Tweet"
TweetWithVisibilityResults: "#/components/schemas/TweetWithVisibilityResults"
TweetTombstone: "#/components/schemas/TweetTombstone"
TweetUnavailable: "#/components/schemas/TweetUnavailable"
TweetWithVisibilityResults:
required:
@ -138,6 +140,13 @@ components:
$ref: "./typename.yaml#/components/schemas/TypeName" # TweetWithVisibilityResults
additionalProperties: true # todo
TweetUnavailable: # nsfw tweet
properties:
__typename:
$ref: "./typename.yaml#/components/schemas/TypeName" # TweetUnavailable
reason:
type: string
Tweet:
required:
- "rest_id"