mirror of
https://github.com/thegeneralist01/twitter-openapi
synced 2026-01-11 15:40:26 +01:00
Merge branch 'main' into dev
Signed-off-by: ふぁ <yuki@yuki0311.com>
This commit is contained in:
commit
6394006bc1
22 changed files with 140 additions and 47 deletions
2
.github/workflows/test-build.yaml
vendored
2
.github/workflows/test-build.yaml
vendored
|
|
@ -39,7 +39,7 @@ jobs:
|
||||||
|
|
||||||
- name: Get Openapi Generator
|
- name: Get Openapi Generator
|
||||||
run: |
|
run: |
|
||||||
wget https://github.com/fa0311/openapi-generator/releases/download/twitter_openapi_python_1.2.0/openapi-generator-cli.jar -O openapi-generator-cli.jar --no-verbose
|
wget https://github.com/fa0311/openapi-generator/releases/download/twitter_openapi_python_1.3.0/openapi-generator-cli.jar -O openapi-generator-cli.jar --no-verbose
|
||||||
if: steps.openapi-generator-cache.outputs.cache-hit != 'true'
|
if: steps.openapi-generator-cache.outputs.cache-hit != 'true'
|
||||||
|
|
||||||
# Python Setup
|
# Python Setup
|
||||||
|
|
|
||||||
5
.github/workflows/test-python.yaml
vendored
5
.github/workflows/test-python.yaml
vendored
|
|
@ -3,6 +3,7 @@ name: test-python
|
||||||
on:
|
on:
|
||||||
pull_request_target:
|
pull_request_target:
|
||||||
types: [labeled]
|
types: [labeled]
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build_and_preview:
|
build_and_preview:
|
||||||
|
|
@ -12,6 +13,8 @@ jobs:
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
ref: "${{ github.event.pull_request.merge_commit_sha }}"
|
||||||
|
|
||||||
# Openapi Generator Setup
|
# Openapi Generator Setup
|
||||||
- name: Get OpenJDK 11
|
- name: Get OpenJDK 11
|
||||||
|
|
@ -37,7 +40,7 @@ jobs:
|
||||||
|
|
||||||
- name: Get Openapi Generator
|
- name: Get Openapi Generator
|
||||||
run: |
|
run: |
|
||||||
wget https://github.com/fa0311/openapi-generator/releases/download/twitter_openapi_python_1.2.0/openapi-generator-cli.jar -O openapi-generator-cli.jar --no-verbose
|
wget https://github.com/fa0311/openapi-generator/releases/download/twitter_openapi_python_1.3.0/openapi-generator-cli.jar -O openapi-generator-cli.jar --no-verbose
|
||||||
if: steps.openapi-generator-cache.outputs.cache-hit != 'true'
|
if: steps.openapi-generator-cache.outputs.cache-hit != 'true'
|
||||||
|
|
||||||
# Python Setup
|
# Python Setup
|
||||||
|
|
|
||||||
4
.vscode/tasks.json
vendored
4
.vscode/tasks.json
vendored
|
|
@ -33,14 +33,14 @@
|
||||||
"command": [
|
"command": [
|
||||||
"python3 -m venv .venv;",
|
"python3 -m venv .venv;",
|
||||||
".venv/bin/python3 -m pip install -r requirements.txt;",
|
".venv/bin/python3 -m pip install -r requirements.txt;",
|
||||||
"wget https://github.com/fa0311/openapi-generator/releases/download/twitter_openapi_python_1.2.0/openapi-generator-cli.jar -O openapi-generator-cli.jar;"
|
"wget https://github.com/fa0311/openapi-generator/releases/download/twitter_openapi_python_1.3.0/openapi-generator-cli.jar -O openapi-generator-cli.jar;"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"windows": {
|
"windows": {
|
||||||
"command": [
|
"command": [
|
||||||
"python -m venv .venv;",
|
"python -m venv .venv;",
|
||||||
".venv/Scripts/python -m pip install -r requirements.txt;",
|
".venv/Scripts/python -m pip install -r requirements.txt;",
|
||||||
"Invoke-WebRequest https://github.com/fa0311/openapi-generator/releases/download/twitter_openapi_python_1.2.0/openapi-generator-cli.jar -OutFile openapi-generator-cli.jar;"
|
"Invoke-WebRequest https://github.com/fa0311/openapi-generator/releases/download/twitter_openapi_python_1.3.0/openapi-generator-cli.jar -OutFile openapi-generator-cli.jar;"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
Twitter OpenAPI(Swagger) specification
|
Twitter OpenAPI(Swagger) specification
|
||||||
|
|
||||||
|
- [Python](https://github.com/fa0311/twitter_openapi_python)
|
||||||
- [Dart](https://github.com/fa0311/twitter_openapi_dart)
|
- [Dart](https://github.com/fa0311/twitter_openapi_dart)
|
||||||
- [TypeScript](https://github.com/fa0311/twitter-openapi-typescript)
|
- [TypeScript](https://github.com/fa0311/twitter-openapi-typescript)
|
||||||
- [React Documents](https://github.com/fa0311/twitter-openapi-docs)
|
- [React Documents](https://github.com/fa0311/twitter-openapi-docs)
|
||||||
|
|
|
||||||
8
dist/compatible/openapi-3.0.yaml
vendored
8
dist/compatible/openapi-3.0.yaml
vendored
|
|
@ -137,11 +137,13 @@ security:
|
||||||
servers:
|
servers:
|
||||||
- url: https://twitter.com/i/api
|
- url: https://twitter.com/i/api
|
||||||
tags:
|
tags:
|
||||||
- description: response User
|
- description: Responses containing User objects.
|
||||||
name: user
|
name: user
|
||||||
- description: response User list
|
- description: Responses containing List[User] objects.
|
||||||
|
name: users
|
||||||
|
- description: Responses containing instruction objects.
|
||||||
name: user-list
|
name: user-list
|
||||||
- description: response tweet
|
- description: Responses containing instruction objects.
|
||||||
name: tweet
|
name: tweet
|
||||||
- description: post
|
- description: post
|
||||||
name: post
|
name: post
|
||||||
|
|
|
||||||
1
dist/compatible/paths/other.yaml
vendored
1
dist/compatible/paths/other.yaml
vendored
|
|
@ -94,7 +94,6 @@ paths:
|
||||||
schema:
|
schema:
|
||||||
oneOf:
|
oneOf:
|
||||||
- $ref: '#/components/schemas/OtherResponse'
|
- $ref: '#/components/schemas/OtherResponse'
|
||||||
- $ref: ./../schemas/error.yaml#/components/schemas/Errors
|
|
||||||
description: Successful operation
|
description: Successful operation
|
||||||
tags:
|
tags:
|
||||||
- other
|
- other
|
||||||
|
|
|
||||||
2
dist/compatible/paths/user.yaml
vendored
2
dist/compatible/paths/user.yaml
vendored
|
|
@ -230,4 +230,4 @@ paths:
|
||||||
schema:
|
schema:
|
||||||
type: string
|
type: string
|
||||||
tags:
|
tags:
|
||||||
- user
|
- users
|
||||||
|
|
|
||||||
1
dist/compatible/schemas/typename.yaml
vendored
1
dist/compatible/schemas/typename.yaml
vendored
|
|
@ -14,6 +14,7 @@ components:
|
||||||
- TweetUnavailable
|
- TweetUnavailable
|
||||||
- Tweet
|
- Tweet
|
||||||
- User
|
- User
|
||||||
|
- UserUnavailable
|
||||||
type: string
|
type: string
|
||||||
info:
|
info:
|
||||||
title: Twitter OpenAPI
|
title: Twitter OpenAPI
|
||||||
|
|
|
||||||
25
dist/compatible/schemas/user.yaml
vendored
25
dist/compatible/schemas/user.yaml
vendored
|
|
@ -165,10 +165,7 @@ components:
|
||||||
- entities
|
- entities
|
||||||
- fast_followers_count
|
- fast_followers_count
|
||||||
- favourites_count
|
- favourites_count
|
||||||
- follow_request_sent
|
|
||||||
- followed_by
|
|
||||||
- followers_count
|
- followers_count
|
||||||
- following
|
|
||||||
- friends_count
|
- friends_count
|
||||||
- has_custom_timelines
|
- has_custom_timelines
|
||||||
- is_translator
|
- is_translator
|
||||||
|
|
@ -178,12 +175,10 @@ components:
|
||||||
- muting
|
- muting
|
||||||
- name
|
- name
|
||||||
- normal_followers_count
|
- normal_followers_count
|
||||||
- notifications
|
|
||||||
- pinned_tweet_ids_str
|
- pinned_tweet_ids_str
|
||||||
- possibly_sensitive
|
- possibly_sensitive
|
||||||
- profile_image_url_https
|
- profile_image_url_https
|
||||||
- profile_interstitial_type
|
- profile_interstitial_type
|
||||||
- protected
|
|
||||||
- screen_name
|
- screen_name
|
||||||
- status
|
- status
|
||||||
- statuses_count
|
- statuses_count
|
||||||
|
|
@ -199,9 +194,27 @@ components:
|
||||||
UserResults:
|
UserResults:
|
||||||
properties:
|
properties:
|
||||||
result:
|
result:
|
||||||
$ref: '#/components/schemas/User'
|
$ref: '#/components/schemas/UserUnion'
|
||||||
required:
|
required:
|
||||||
- result
|
- result
|
||||||
|
UserUnavailable:
|
||||||
|
properties:
|
||||||
|
__typename:
|
||||||
|
$ref: ./typename.yaml#/components/schemas/TypeName
|
||||||
|
reason:
|
||||||
|
type: string
|
||||||
|
required:
|
||||||
|
- __typename
|
||||||
|
- reason
|
||||||
|
UserUnion:
|
||||||
|
discriminator:
|
||||||
|
mapping":
|
||||||
|
User: '#/components/schemas/User'
|
||||||
|
UserUnavailable: '#/components/schemas/UserUnavailable'
|
||||||
|
propertyName: __typename
|
||||||
|
oneOf:
|
||||||
|
- $ref: '#/components/schemas/User'
|
||||||
|
- $ref: '#/components/schemas/UserUnavailable'
|
||||||
info:
|
info:
|
||||||
title: Twitter OpenAPI
|
title: Twitter OpenAPI
|
||||||
version: 0.0.1
|
version: 0.0.1
|
||||||
|
|
|
||||||
8
dist/docs/openapi-3.0.yaml
vendored
8
dist/docs/openapi-3.0.yaml
vendored
|
|
@ -137,11 +137,13 @@ security:
|
||||||
servers:
|
servers:
|
||||||
- url: https://twitter.com/i/api
|
- url: https://twitter.com/i/api
|
||||||
tags:
|
tags:
|
||||||
- description: response User
|
- description: Responses containing User objects.
|
||||||
name: user
|
name: user
|
||||||
- description: response User list
|
- description: Responses containing List[User] objects.
|
||||||
|
name: users
|
||||||
|
- description: Responses containing instruction objects.
|
||||||
name: user-list
|
name: user-list
|
||||||
- description: response tweet
|
- description: Responses containing instruction objects.
|
||||||
name: tweet
|
name: tweet
|
||||||
- description: post
|
- description: post
|
||||||
name: post
|
name: post
|
||||||
|
|
|
||||||
1
dist/docs/paths/other.yaml
vendored
1
dist/docs/paths/other.yaml
vendored
|
|
@ -94,7 +94,6 @@ paths:
|
||||||
schema:
|
schema:
|
||||||
oneOf:
|
oneOf:
|
||||||
- $ref: '#/components/schemas/OtherResponse'
|
- $ref: '#/components/schemas/OtherResponse'
|
||||||
- $ref: ./../schemas/error.yaml#/components/schemas/Errors
|
|
||||||
description: Successful operation
|
description: Successful operation
|
||||||
tags:
|
tags:
|
||||||
- other
|
- other
|
||||||
|
|
|
||||||
2
dist/docs/paths/user.yaml
vendored
2
dist/docs/paths/user.yaml
vendored
|
|
@ -335,4 +335,4 @@ paths:
|
||||||
schema:
|
schema:
|
||||||
type: string
|
type: string
|
||||||
tags:
|
tags:
|
||||||
- user
|
- users
|
||||||
|
|
|
||||||
1
dist/docs/schemas/typename.yaml
vendored
1
dist/docs/schemas/typename.yaml
vendored
|
|
@ -14,6 +14,7 @@ components:
|
||||||
- TweetUnavailable
|
- TweetUnavailable
|
||||||
- Tweet
|
- Tweet
|
||||||
- User
|
- User
|
||||||
|
- UserUnavailable
|
||||||
type: string
|
type: string
|
||||||
info:
|
info:
|
||||||
title: Twitter OpenAPI
|
title: Twitter OpenAPI
|
||||||
|
|
|
||||||
25
dist/docs/schemas/user.yaml
vendored
25
dist/docs/schemas/user.yaml
vendored
|
|
@ -165,10 +165,7 @@ components:
|
||||||
- entities
|
- entities
|
||||||
- fast_followers_count
|
- fast_followers_count
|
||||||
- favourites_count
|
- favourites_count
|
||||||
- follow_request_sent
|
|
||||||
- followed_by
|
|
||||||
- followers_count
|
- followers_count
|
||||||
- following
|
|
||||||
- friends_count
|
- friends_count
|
||||||
- has_custom_timelines
|
- has_custom_timelines
|
||||||
- is_translator
|
- is_translator
|
||||||
|
|
@ -178,12 +175,10 @@ components:
|
||||||
- muting
|
- muting
|
||||||
- name
|
- name
|
||||||
- normal_followers_count
|
- normal_followers_count
|
||||||
- notifications
|
|
||||||
- pinned_tweet_ids_str
|
- pinned_tweet_ids_str
|
||||||
- possibly_sensitive
|
- possibly_sensitive
|
||||||
- profile_image_url_https
|
- profile_image_url_https
|
||||||
- profile_interstitial_type
|
- profile_interstitial_type
|
||||||
- protected
|
|
||||||
- screen_name
|
- screen_name
|
||||||
- status
|
- status
|
||||||
- statuses_count
|
- statuses_count
|
||||||
|
|
@ -199,9 +194,27 @@ components:
|
||||||
UserResults:
|
UserResults:
|
||||||
properties:
|
properties:
|
||||||
result:
|
result:
|
||||||
$ref: '#/components/schemas/User'
|
$ref: '#/components/schemas/UserUnion'
|
||||||
required:
|
required:
|
||||||
- result
|
- result
|
||||||
|
UserUnavailable:
|
||||||
|
properties:
|
||||||
|
__typename:
|
||||||
|
$ref: ./typename.yaml#/components/schemas/TypeName
|
||||||
|
reason:
|
||||||
|
type: string
|
||||||
|
required:
|
||||||
|
- __typename
|
||||||
|
- reason
|
||||||
|
UserUnion:
|
||||||
|
discriminator:
|
||||||
|
mapping":
|
||||||
|
User: '#/components/schemas/User'
|
||||||
|
UserUnavailable: '#/components/schemas/UserUnavailable'
|
||||||
|
propertyName: __typename
|
||||||
|
oneOf:
|
||||||
|
- $ref: '#/components/schemas/User'
|
||||||
|
- $ref: '#/components/schemas/UserUnavailable'
|
||||||
info:
|
info:
|
||||||
title: Twitter OpenAPI
|
title: Twitter OpenAPI
|
||||||
version: 0.0.1
|
version: 0.0.1
|
||||||
|
|
|
||||||
|
|
@ -56,11 +56,13 @@ security:
|
||||||
- AuthType: []
|
- AuthType: []
|
||||||
tags:
|
tags:
|
||||||
- name: user
|
- name: user
|
||||||
description: response User
|
description: Responses containing User objects.
|
||||||
|
- name: users
|
||||||
|
description: Responses containing List[User] objects.
|
||||||
- name: user-list
|
- name: user-list
|
||||||
description: response User list
|
description: Responses containing instruction objects.
|
||||||
- name: tweet
|
- name: tweet
|
||||||
description: response tweet
|
description: Responses containing instruction objects.
|
||||||
- name: post
|
- name: post
|
||||||
description: post
|
description: post
|
||||||
- name: v1.1-get
|
- name: v1.1-get
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,6 @@ paths:
|
||||||
schema:
|
schema:
|
||||||
oneOf:
|
oneOf:
|
||||||
- $ref: "#/components/schemas/OtherResponse"
|
- $ref: "#/components/schemas/OtherResponse"
|
||||||
- $ref: "./../schemas/error.yaml#/components/schemas/Errors"
|
|
||||||
tags:
|
tags:
|
||||||
- "other"
|
- "other"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ paths:
|
||||||
- $ref: "#/components/schemas/UsersResponse"
|
- $ref: "#/components/schemas/UsersResponse"
|
||||||
- $ref: "./../schemas/error.yaml#/components/schemas/Errors"
|
- $ref: "./../schemas/error.yaml#/components/schemas/Errors"
|
||||||
tags:
|
tags:
|
||||||
- "user"
|
- "users"
|
||||||
|
|
||||||
components:
|
components:
|
||||||
schemas:
|
schemas:
|
||||||
|
|
|
||||||
|
|
@ -21,4 +21,5 @@ components:
|
||||||
TweetUnavailable,
|
TweetUnavailable,
|
||||||
Tweet,
|
Tweet,
|
||||||
User,
|
User,
|
||||||
|
UserUnavailable,
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,17 @@ components:
|
||||||
- "result"
|
- "result"
|
||||||
properties:
|
properties:
|
||||||
result:
|
result:
|
||||||
$ref: "#/components/schemas/User"
|
$ref: "#/components/schemas/UserUnion"
|
||||||
|
|
||||||
|
UserUnion:
|
||||||
|
oneOf:
|
||||||
|
- $ref: "#/components/schemas/User"
|
||||||
|
- $ref: "#/components/schemas/UserUnavailable"
|
||||||
|
discriminator:
|
||||||
|
propertyName: __typename
|
||||||
|
mapping": # deprecated
|
||||||
|
User: "#/components/schemas/User"
|
||||||
|
UserUnavailable: "#/components/schemas/UserUnavailable"
|
||||||
|
|
||||||
User:
|
User:
|
||||||
required:
|
required:
|
||||||
|
|
@ -79,10 +89,10 @@ components:
|
||||||
- "entities"
|
- "entities"
|
||||||
- "fast_followers_count"
|
- "fast_followers_count"
|
||||||
- "favourites_count"
|
- "favourites_count"
|
||||||
- "follow_request_sent"
|
# 31 # - "follow_request_sent"
|
||||||
- "followed_by"
|
# 31 # - "followed_by"
|
||||||
- "followers_count"
|
- "followers_count"
|
||||||
- "following"
|
# 31 # - "following"
|
||||||
- "friends_count"
|
- "friends_count"
|
||||||
- "has_custom_timelines"
|
- "has_custom_timelines"
|
||||||
- "is_translator"
|
- "is_translator"
|
||||||
|
|
@ -92,12 +102,12 @@ components:
|
||||||
- "muting"
|
- "muting"
|
||||||
- "name"
|
- "name"
|
||||||
- "normal_followers_count"
|
- "normal_followers_count"
|
||||||
- "notifications"
|
# 31 # - "notifications"
|
||||||
- "pinned_tweet_ids_str"
|
- "pinned_tweet_ids_str"
|
||||||
- "possibly_sensitive"
|
- "possibly_sensitive"
|
||||||
- "profile_image_url_https"
|
- "profile_image_url_https"
|
||||||
- "profile_interstitial_type"
|
- "profile_interstitial_type"
|
||||||
- "protected"
|
# 31 # - "protected"
|
||||||
- "screen_name"
|
- "screen_name"
|
||||||
- "status"
|
- "status"
|
||||||
- "statuses_count"
|
- "statuses_count"
|
||||||
|
|
@ -211,3 +221,13 @@ components:
|
||||||
want_retweets:
|
want_retweets:
|
||||||
type: boolean
|
type: boolean
|
||||||
default: false
|
default: false
|
||||||
|
|
||||||
|
UserUnavailable:
|
||||||
|
required:
|
||||||
|
- "__typename"
|
||||||
|
- "reason"
|
||||||
|
properties:
|
||||||
|
__typename:
|
||||||
|
$ref: "./typename.yaml#/components/schemas/TypeName" # UserUnavailable
|
||||||
|
reason:
|
||||||
|
type: string
|
||||||
|
|
|
||||||
|
|
@ -131,6 +131,17 @@ for file in glob.glob("cache/*.json"):
|
||||||
logger.info(f"Success: {len(glob.glob('cache/*.json'))}")
|
logger.info(f"Success: {len(glob.glob('cache/*.json'))}")
|
||||||
|
|
||||||
|
|
||||||
|
def error_dump(e):
|
||||||
|
if ERROR_UNCATCHED:
|
||||||
|
raise
|
||||||
|
import traceback
|
||||||
|
|
||||||
|
logger.error("==========[STACK TRACE]==========")
|
||||||
|
for trace in traceback.format_exc().split("\n"):
|
||||||
|
logger.error(trace)
|
||||||
|
logger.info("================================")
|
||||||
|
|
||||||
|
|
||||||
api_conf = pt.Configuration(
|
api_conf = pt.Configuration(
|
||||||
api_key={
|
api_key={
|
||||||
"ClientLanguage": "en",
|
"ClientLanguage": "en",
|
||||||
|
|
@ -147,7 +158,7 @@ api_client.user_agent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/5
|
||||||
|
|
||||||
error_count = 0
|
error_count = 0
|
||||||
|
|
||||||
for x in [pt.DefaultApi, pt.TweetApi, pt.UserApi, pt.UserListApi]:
|
for x in [pt.DefaultApi, pt.TweetApi, pt.UserApi, pt.UsersApi, pt.UserListApi]:
|
||||||
for props, fn in x.__dict__.items():
|
for props, fn in x.__dict__.items():
|
||||||
if not callable(fn):
|
if not callable(fn):
|
||||||
continue
|
continue
|
||||||
|
|
@ -185,14 +196,26 @@ for x in [pt.DefaultApi, pt.TweetApi, pt.UserApi, pt.UserListApi]:
|
||||||
time.sleep(SLEEP_TIME)
|
time.sleep(SLEEP_TIME)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
if ERROR_UNCATCHED:
|
error_dump(e)
|
||||||
raise
|
error_count += 1
|
||||||
import traceback
|
|
||||||
|
|
||||||
logger.error("==========[STACK TRACE]==========")
|
|
||||||
for trace in traceback.format_exc().split("\n"):
|
try:
|
||||||
logger.error(trace)
|
logger.info(f"Try: Self UserByScreenName Test")
|
||||||
logger.info("================================")
|
kwargs = get_kwargs("UserByScreenName", {"screen_name": "a810810931931"})
|
||||||
|
res = pt.UserApi(api_client).get_user_by_screen_name(**kwargs).to_dict()
|
||||||
|
if not res["data"]["user"]["result"]["legacy"]["screen_name"] == "a810810931931":
|
||||||
|
raise Exception("UserByScreenName failed")
|
||||||
|
except Exception as e:
|
||||||
|
error_dump(e)
|
||||||
|
error_count += 1
|
||||||
|
|
||||||
|
try:
|
||||||
|
logger.info(f"Try: Self UserTweets Test")
|
||||||
|
kwargs = get_kwargs("UserTweets", {"userId": "1180389371481976833"})
|
||||||
|
pt.TweetApi(api_client).get_user_tweets(**kwargs)
|
||||||
|
except Exception as e:
|
||||||
|
error_dump(e)
|
||||||
error_count += 1
|
error_count += 1
|
||||||
|
|
||||||
if error_count > 0:
|
if error_count > 0:
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ class Config:
|
||||||
AddPathQueryIdOnParameters(split=-1),
|
AddPathQueryIdOnParameters(split=-1),
|
||||||
getParamHook,
|
getParamHook,
|
||||||
]
|
]
|
||||||
for key in ["default", "user", "user-list", "tweet"]
|
for key in ["default", "user", "users", "user-list", "tweet"]
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
key: [
|
key: [
|
||||||
|
|
|
||||||
|
|
@ -118,6 +118,20 @@ class SchemasCheck(SchemasHookBase):
|
||||||
return value
|
return value
|
||||||
|
|
||||||
|
|
||||||
|
class RequiredCheck(SchemasHookBase):
|
||||||
|
def hook(self, value: dict):
|
||||||
|
required = value.get("required", [])
|
||||||
|
|
||||||
|
for key, property in value.get("properties", {}).items():
|
||||||
|
if key in required and property.get("default") is not None:
|
||||||
|
print(f"{key} is required and has default value")
|
||||||
|
d = property.get("default") is None and property.get("nullable", False)
|
||||||
|
if property not in required and d:
|
||||||
|
print(f"{key} is not required and has no default value")
|
||||||
|
|
||||||
|
return value
|
||||||
|
|
||||||
|
|
||||||
# RequestHookBase extends
|
# RequestHookBase extends
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue