1
Fork 0
mirror of https://github.com/thegeneralist01/twitter-openapi synced 2026-01-11 07:30:37 +01:00

Merge pull request #57 from fa0311/dev

Dev
This commit is contained in:
ふぁ 2024-02-19 13:10:20 +09:00 committed by GitHub
commit 02aaf02751
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 94 additions and 32 deletions

3
.vscode/launch.json vendored
View file

@ -28,7 +28,8 @@
"env": {
"ERROR_UNCATCHED": "True",
"STRICT_MODE": "True",
"MULTI_THREAD": "True"
"MULTI_THREAD": "True",
"CUESOR_TEST_COUNT": "3"
}
}
]

2
.vscode/tasks.json vendored
View file

@ -9,7 +9,6 @@
"source .venv/bin/activate;",
"python3 tools/build.py;",
"java -jar openapi-generator-cli.jar generate -c test/python/openapi-generator-config.yaml -g python;",
"python3 test/python/replace.py;",
"python3 -m pip install ./python_generated;"
]
},
@ -19,7 +18,6 @@
"python tools/build.py;",
"scoop reset temurin11-jdk;",
"java -jar openapi-generator-cli.jar generate -c test/python/openapi-generator-config.yaml -g python;",
"python test/python/replace.py;",
"python -m pip install ./python_generated;"
]
}

View file

@ -564,6 +564,10 @@ components:
items:
$ref: '#/components/schemas/Symbol'
type: array
timestamps:
items:
$ref: '#/components/schemas/Timestamp'
type: array
urls:
items:
$ref: '#/components/schemas/Url'
@ -1793,6 +1797,20 @@ components:
$ref: '#/components/schemas/Timeline'
required:
- timeline
Timestamp:
properties:
indices:
items:
type: integer
type: array
seconds:
type: integer
text:
type: string
required:
- indices
- seconds
- text
TopicContext:
properties:
description:
@ -2159,10 +2177,11 @@ components:
limited_actions:
enum:
- limited_replies
- community_tweet_non_member_public_community
- non_compliant
- dynamic_product_ad
- stale_tweet
- community_tweet_non_member_public_community
- community_tweet_non_member_closed_community
type: string
place:
additionalProperties: true
@ -2790,6 +2809,8 @@ components:
properties:
__typename:
$ref: '#/components/schemas/TypeName'
message:
type: string
reason:
type: string
required:

View file

@ -564,6 +564,10 @@ components:
items:
$ref: '#/components/schemas/Symbol'
type: array
timestamps:
items:
$ref: '#/components/schemas/Timestamp'
type: array
urls:
items:
$ref: '#/components/schemas/Url'
@ -1793,6 +1797,20 @@ components:
$ref: '#/components/schemas/Timeline'
required:
- timeline
Timestamp:
properties:
indices:
items:
type: integer
type: array
seconds:
type: integer
text:
type: string
required:
- indices
- seconds
- text
TopicContext:
properties:
description:
@ -2159,10 +2177,11 @@ components:
limited_actions:
enum:
- limited_replies
- community_tweet_non_member_public_community
- non_compliant
- dynamic_product_ad
- stale_tweet
- community_tweet_non_member_public_community
- community_tweet_non_member_closed_community
type: string
place:
additionalProperties: true
@ -2790,6 +2809,8 @@ components:
properties:
__typename:
$ref: '#/components/schemas/TypeName'
message:
type: string
reason:
type: string
required:

View file

@ -564,6 +564,10 @@ components:
items:
$ref: '#/components/schemas/Symbol'
type: array
timestamps:
items:
$ref: '#/components/schemas/Timestamp'
type: array
urls:
items:
$ref: '#/components/schemas/Url'
@ -1793,6 +1797,20 @@ components:
$ref: '#/components/schemas/Timeline'
required:
- timeline
Timestamp:
properties:
indices:
items:
type: integer
type: array
seconds:
type: integer
text:
type: string
required:
- indices
- seconds
- text
TopicContext:
properties:
description:
@ -2159,10 +2177,11 @@ components:
limited_actions:
enum:
- limited_replies
- community_tweet_non_member_public_community
- non_compliant
- dynamic_product_ad
- stale_tweet
- community_tweet_non_member_public_community
- community_tweet_non_member_closed_community
type: string
place:
additionalProperties: true
@ -2790,6 +2809,8 @@ components:
properties:
__typename:
$ref: '#/components/schemas/TypeName'
message:
type: string
reason:
type: string
required:

View file

@ -680,7 +680,6 @@ components:
$ref: "#/components/schemas/BirdwatchEntity"
BirdwatchPivotCallToAction:
# {'prompt': 'Do you find this helpful?', 'title': 'Rate it', 'destinationUrl': 'https://twitter.com/i/birdwatch/n/1710821689636934115'}
required:
- "prompt"
- "title"
@ -906,10 +905,11 @@ components:
type: string
enum:
- "limited_replies"
- "community_tweet_non_member_public_community"
- "non_compliant"
- "dynamic_product_ad"
- "stale_tweet"
- "community_tweet_non_member_public_community"
- "community_tweet_non_member_closed_community"
place:
additionalProperties: true # todo
@ -927,6 +927,7 @@ components:
- "symbols"
- "user_mentions"
- "urls"
- "timestamps"
properties:
hashtags:
type: array
@ -948,6 +949,10 @@ components:
type: array
items:
$ref: "#/components/schemas/Media"
timestamps:
type: array
items:
$ref: "#/components/schemas/Timestamp"
Hashtag:
type: object
@ -1293,3 +1298,18 @@ components:
resize:
type: string
enum: [crop, fit]
Timestamp:
required:
- "indices"
- "seconds"
- "text"
properties:
indices:
type: array
items:
type: integer
seconds:
type: integer
text:
type: string

View file

@ -356,3 +356,5 @@ components:
$ref: "./typename.yaml#/components/schemas/TypeName" # UserUnavailable
reason:
type: string
message:
type: string

View file

@ -1,4 +1,4 @@
inputSpec: dist/compatible/openapi-3.0.yaml
inputSpec: dist/compatible_discriminator/openapi-3.0.yaml
outputDir: python_generated
useOneOfDiscriminatorLookup: true

View file

@ -1,23 +0,0 @@
import glob
for file in glob.glob("python_generated/openapi_client/models/*.py"):
with open(file, "r") as f:
text = f.read()
indent = " "
text = text.replace(
f"{indent}{indent}try:",
f"{indent}{indent}if match == 0:",
)
text = text.replace(
f"{indent}{indent}except (ValidationError, ValueError) as e:",
f"{indent}{indent}else:",
)
text = text.replace(
f"{indent}{indent}{indent}error_messages.append(str(e))",
f"{indent}{indent}{indent}pass",
)
with open(file, "w") as f:
f.write(text)

View file

@ -326,6 +326,7 @@ if __name__ == "__main__":
"1697450269259522256",
"1697450278742884799",
"1749500209061663043",
"1759056048764469303",
]
for id in ids:
try: