diff --git a/src/openapi/paths/bookmarks.yaml b/src/openapi/paths/bookmarks.yaml index e26c1ce..f118db9 100644 --- a/src/openapi/paths/bookmarks.yaml +++ b/src/openapi/paths/bookmarks.yaml @@ -4,10 +4,12 @@ info: version: 0.0.1 paths: - /graphql/{{queryId}}/Bookmarks: + /graphql/{queryId}/Bookmarks: get: operationId: getBookmarks description: get bookmarks + parameters: + - $ref: "../resources/parameters.yaml#/components/parameters/queryId" responses: "200": description: Successful operation diff --git a/src/openapi/paths/follow.yaml b/src/openapi/paths/follow.yaml index 305922f..4883c21 100644 --- a/src/openapi/paths/follow.yaml +++ b/src/openapi/paths/follow.yaml @@ -4,10 +4,12 @@ info: version: 0.0.1 paths: - /graphql/{{queryId}}/Following: + /graphql/{queryId}/Following: get: operationId: getFollowing description: get user list of following + parameters: + - $ref: "../resources/parameters.yaml#/components/parameters/queryId" responses: "200": description: Successful operation @@ -18,10 +20,12 @@ paths: tags: - "user-list" - /graphql/{{queryId}}/Followers: + /graphql/{queryId}/Followers: get: operationId: getFollowers description: get user list of followers + parameters: + - $ref: "../resources/parameters.yaml#/components/parameters/queryId" responses: "200": description: Successful operation diff --git a/src/openapi/paths/post.yaml b/src/openapi/paths/post.yaml index 0b74e28..4d7cbdc 100644 --- a/src/openapi/paths/post.yaml +++ b/src/openapi/paths/post.yaml @@ -4,10 +4,12 @@ info: version: 0.0.1 paths: - /graphql/{{queryId}}/FavoriteTweet: + /graphql/{queryId}/FavoriteTweet: post: operationId: postFavoriteTweet description: favorite Tweet + parameters: + - $ref: "../resources/parameters.yaml#/components/parameters/queryId" responses: "200": description: Successful operation @@ -18,10 +20,12 @@ paths: tags: - "post" - /graphql/{{queryId}}/UnfavoriteTweet: + /graphql/{queryId}/UnfavoriteTweet: post: operationId: postUnfavoriteTweet description: unfavorite Tweet + parameters: + - $ref: "../resources/parameters.yaml#/components/parameters/queryId" responses: "200": description: Successful operation @@ -32,10 +36,12 @@ paths: tags: - "post" - /graphql/{{queryId}}/CreateRetweet: + /graphql/{queryId}/CreateRetweet: post: operationId: postCreateRetweet description: create Retweet + parameters: + - $ref: "../resources/parameters.yaml#/components/parameters/queryId" responses: "200": description: Successful operation @@ -46,10 +52,12 @@ paths: tags: - "post" - /graphql/{{queryId}}/DeleteRetweet: + /graphql/{queryId}/DeleteRetweet: post: operationId: postDeleteRetweet description: delete Retweet + parameters: + - $ref: "../resources/parameters.yaml#/components/parameters/queryId" responses: "200": description: Successful operation @@ -60,10 +68,12 @@ paths: tags: - "post" - /graphql/{{queryId}}/CreateTweet: + /graphql/{queryId}/CreateTweet: post: operationId: postCreateTweet description: create Tweet + parameters: + - $ref: "../resources/parameters.yaml#/components/parameters/queryId" responses: "200": description: Successful operation @@ -74,10 +84,12 @@ paths: tags: - "post" - /graphql/{{queryId}}/DeleteTweet: + /graphql/{queryId}/DeleteTweet: post: operationId: postDeleteTweet description: delete Retweet + parameters: + - $ref: "../resources/parameters.yaml#/components/parameters/queryId" responses: "200": description: Successful operation diff --git a/src/openapi/paths/profile.yaml b/src/openapi/paths/profile.yaml index 67682fa..3c16a32 100644 --- a/src/openapi/paths/profile.yaml +++ b/src/openapi/paths/profile.yaml @@ -4,10 +4,12 @@ info: version: 0.0.1 paths: - /graphql/{{queryId}}/ProfileSpotlightsQuery: + /graphql/{queryId}/ProfileSpotlightsQuery: get: operationId: getProfileSpotlightsQuery description: "get user by screen name" + parameters: + - $ref: "../resources/parameters.yaml#/components/parameters/queryId" responses: "200": description: Successful operation diff --git a/src/openapi/paths/timeline.yaml b/src/openapi/paths/timeline.yaml index 12a4345..b615d89 100644 --- a/src/openapi/paths/timeline.yaml +++ b/src/openapi/paths/timeline.yaml @@ -4,10 +4,12 @@ info: version: 0.0.1 paths: - /graphql/{{queryId}}/HomeTimeline: + /graphql/{queryId}/HomeTimeline: get: operationId: getHomeTimeline description: get tweet list of timeline + parameters: + - $ref: "../resources/parameters.yaml#/components/parameters/queryId" responses: "200": description: Successful operation @@ -18,10 +20,12 @@ paths: tags: - "tweet" - /graphql/{{queryId}}/HomeLatestTimeline: + /graphql/{queryId}/HomeLatestTimeline: get: operationId: getHomeLatestTimeline description: get tweet list of timeline + parameters: + - $ref: "../resources/parameters.yaml#/components/parameters/queryId" responses: "200": description: Successful operation @@ -32,10 +36,12 @@ paths: tags: - "tweet" - /graphql/{{queryId}}/ListLatestTweetsTimeline: + /graphql/{queryId}/ListLatestTweetsTimeline: get: operationId: getListLatestTweetsTimeline description: get tweet list of timeline + parameters: + - $ref: "../resources/parameters.yaml#/components/parameters/queryId" responses: "200": description: Successful operation diff --git a/src/openapi/paths/tweet.yaml b/src/openapi/paths/tweet.yaml index 9f0539f..862d097 100644 --- a/src/openapi/paths/tweet.yaml +++ b/src/openapi/paths/tweet.yaml @@ -4,10 +4,12 @@ info: version: 0.0.1 paths: - /graphql/{{queryId}}/TweetDetail: + /graphql/{queryId}/TweetDetail: get: operationId: getTweetDetail description: get TweetDetail + parameters: + - $ref: "../resources/parameters.yaml#/components/parameters/queryId" responses: "200": description: Successful operation diff --git a/src/openapi/paths/user.yaml b/src/openapi/paths/user.yaml index 874bd13..48c5d56 100644 --- a/src/openapi/paths/user.yaml +++ b/src/openapi/paths/user.yaml @@ -4,10 +4,12 @@ info: version: 0.0.1 paths: - /graphql/{{queryId}}/UserByScreenName: + /graphql/{queryId}/UserByScreenName: get: operationId: getUserByScreenName description: "get user by screen name" + parameters: + - $ref: "../resources/parameters.yaml#/components/parameters/queryId" responses: "200": description: Successful operation diff --git a/src/openapi/paths/usertweets.yaml b/src/openapi/paths/usertweets.yaml index c1013d0..9427fc3 100644 --- a/src/openapi/paths/usertweets.yaml +++ b/src/openapi/paths/usertweets.yaml @@ -4,10 +4,12 @@ info: version: 0.0.1 paths: - /graphql/{{queryId}}/UserTweets: + /graphql/{queryId}/UserTweets: get: operationId: getUserTweets description: "get user tweets" + parameters: + - $ref: "../resources/parameters.yaml#/components/parameters/queryId" responses: "200": description: Successful operation @@ -18,10 +20,12 @@ paths: tags: - "tweet" - /graphql/{{queryId}}/UserTweetsAndReplies: + /graphql/{queryId}/UserTweetsAndReplies: get: operationId: getUserTweetsAndReplies description: "get user replies tweets" + parameters: + - $ref: "../resources/parameters.yaml#/components/parameters/queryId" responses: "200": description: Successful operation @@ -32,10 +36,12 @@ paths: tags: - "tweet" - /graphql/{{queryId}}/UserMedia: + /graphql/{queryId}/UserMedia: get: operationId: getUserMedia description: "get user media tweets" + parameters: + - $ref: "../resources/parameters.yaml#/components/parameters/queryId" responses: "200": description: Successful operation @@ -46,10 +52,12 @@ paths: tags: - "tweet" - /graphql/{{queryId}}/Likes: + /graphql/{queryId}/Likes: get: operationId: getLikes description: "get user likes tweets" + parameters: + - $ref: "../resources/parameters.yaml#/components/parameters/queryId" responses: "200": description: Successful operation diff --git a/src/openapi/resources/parameters.yaml b/src/openapi/resources/parameters.yaml new file mode 100644 index 0000000..03f562f --- /dev/null +++ b/src/openapi/resources/parameters.yaml @@ -0,0 +1,11 @@ +openapi: 3.0.3 +paths: {} + +components: + parameters: + queryId: + name: queryId + in: path + required: true + schema: + type: string \ No newline at end of file diff --git a/tools/build_config.py b/tools/build_config.py index eaba346..ae890b9 100644 --- a/tools/build_config.py +++ b/tools/build_config.py @@ -13,7 +13,6 @@ class Config: "other":[], "request": { key: [ - ReplaceQueryIdPlaceholder(split=-1), SetResponsesHeader(suffix=None), AddParametersOnContent( split=-1, contentType="application/json" @@ -23,7 +22,6 @@ class Config: } | { key: [ - ReplaceQueryIdPlaceholder(split=-1), SetResponsesHeader(suffix=None), AddParametersOnParameters( split=-1, @@ -61,7 +59,6 @@ class Config: "other":[], "request": { key: [ - ReplaceQueryIdPlaceholder(split=-1), AddSecuritySchemesOnHeader(split=-1), SetResponsesHeader(suffix=None), AddParametersOnParameters( @@ -73,7 +70,6 @@ class Config: } | { key: [ - ReplaceQueryIdPlaceholder(split=-1), AddSecuritySchemesOnHeader(split=-1), SetResponsesHeader(suffix=None), AddParametersOnBody( @@ -115,7 +111,6 @@ class Config: "other":[], "request": { key: [ - ReplaceQueryIdPlaceholder(split=-1), SetResponsesHeader(suffix=None), AddParametersOnParameters( split=-1, @@ -126,7 +121,6 @@ class Config: } | { key: [ - ReplaceQueryIdPlaceholder(split=-1), SetResponsesHeader(suffix=None), AddParametersOnBody( split=-1, @@ -165,7 +159,6 @@ class Config: "other":[], "request": { key: [ - ReplaceQueryIdPlaceholder(split=-1), SetResponsesHeader(suffix=None), AddParametersOnParameters( split=-1, @@ -176,7 +169,6 @@ class Config: } | { key: [ - ReplaceQueryIdPlaceholder(split=-1), SetResponsesHeader(suffix=None), AddParametersOnParameters( split=-1, diff --git a/tools/hooks.py b/tools/hooks.py index 742a0eb..b3c0030 100644 --- a/tools/hooks.py +++ b/tools/hooks.py @@ -118,14 +118,6 @@ class AddSecuritySchemesOnHeader(RequestHookBase): value["parameters"].extend(param) return path, value - -class ReplaceQueryIdPlaceholder(RequestHookBase): - def hook(self, path: str, value: dict): - path, value = super().hook(path, value) - new = self.PLACEHOLDER[self.path_name]["queryId"] - return path.replace(r"{{queryId}}", new), value - - class SetResponsesHeader(RequestHookBase): suffix: str