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

update hook

Signed-off-by: ふぁ <yuki@yuki0311.com>
This commit is contained in:
ふぁ 2023-05-05 19:35:31 +09:00
parent 055a646047
commit 9a73269895
No known key found for this signature in database
GPG key ID: 83A8A5E74872A8AA
5 changed files with 66 additions and 31 deletions

View file

@ -110,38 +110,32 @@ paths:
'200': '200':
description: Successful operation description: Successful operation
headers: headers:
status:
schema:
type: string
x-access-level:
schema:
type: string
x-client-event-enabled:
schema:
type: boolean
x-connection-hash: x-connection-hash:
schema: schema:
type: string type: string
x-content-type-options: x-content-type-options:
schema: schema:
type: string type: string
x-frame-options:
schema:
type: string
x-rate-limit-limit:
schema:
type: integer
x-rate-limit-remaining:
schema:
type: integer
x-rate-limit-reset:
schema:
type: integer
x-response-time: x-response-time:
schema: schema:
type: integer type: integer
x-tfe-preserve-body: x-transaction:
schema: schema:
type: boolean type: string
x-transaction-id: x-transaction-id:
schema: schema:
type: string type: string
x-twitter-response-tags: x-twitter-response-tags:
schema: schema:
type: string type: string
x-xss-protection:
schema:
type: integer
tags: tags:
- v1.1 - v1.1

View file

@ -9,12 +9,6 @@ components:
x-connection-hash: x-connection-hash:
schema: schema:
type: string type: string
x-content-type-options:
schema:
type: string
x-frame-options:
schema:
type: string
x-rate-limit-limit: x-rate-limit-limit:
schema: schema:
type: integer type: integer
@ -36,6 +30,3 @@ components:
x-twitter-response-tags: x-twitter-response-tags:
schema: schema:
type: string type: string
x-xss-protection:
schema:
type: integer

View file

@ -0,0 +1,35 @@
openapi: 3.0.3
info:
title: Twitter OpenAPI
version: 0.0.1
paths: {}
components:
headers:
status:
schema:
type: string
x-access-level:
schema:
type: string
x-client-event-enabled:
schema:
type: boolean
x-connection-hash:
schema:
type: string
x-content-type-options:
schema:
type: string
x-response-time:
schema:
type: integer
x-transaction:
schema:
type: string
x-transaction-id:
schema:
type: string
x-twitter-response-tags:
schema:
type: string

View file

@ -23,7 +23,7 @@ class Config:
SetResponsesHeader(), SetResponsesHeader(),
AddParametersOnParameters(), AddParametersOnParameters(),
], ],
"v1.1": [SetResponsesHeader(), AddParametersOnParameters()], "v1.1": [SetResponsesHeader("v1.1"), AddParametersOnParameters()],
}, },
}, },
"dart": { "dart": {
@ -44,7 +44,10 @@ class Config:
SetResponsesHeader(), SetResponsesHeader(),
AddParametersOnParametersAsObject(), AddParametersOnParametersAsObject(),
], ],
"v1.1": [SetResponsesHeader(), AddParametersOnParametersAsObject()], "v1.1": [
SetResponsesHeader("v1.1"),
AddParametersOnParametersAsObject(),
],
}, },
}, },
"typescript": { "typescript": {
@ -63,7 +66,10 @@ class Config:
SetResponsesHeader(), SetResponsesHeader(),
AddParametersOnParametersAsObject(), AddParametersOnParametersAsObject(),
], ],
"v1.1": [SetResponsesHeader(), AddParametersOnParametersAsObject()], "v1.1": [
SetResponsesHeader("v1.1"),
AddParametersOnParametersAsObject(),
],
}, },
}, },
"test": { "test": {
@ -82,7 +88,10 @@ class Config:
SetResponsesHeader(), SetResponsesHeader(),
AddParametersOnParametersAsString(), AddParametersOnParametersAsString(),
], ],
"v1.1": [SetResponsesHeader(), AddParametersOnParametersAsString()], "v1.1": [
SetResponsesHeader("v1.1"),
AddParametersOnParametersAsString(),
],
}, },
}, },
} }

View file

@ -85,8 +85,14 @@ class ReplaceQueryIdPlaceholder(RequestHookBase):
class SetResponsesHeader(RequestHookBase): class SetResponsesHeader(RequestHookBase):
prexix: str
def __init__(self, prexix: str = ""):
super().__init__()
self.prexix = prexix if prexix == "" else "_" + prexix
def hook(self, path: str, value: dict): def hook(self, path: str, value: dict):
component = self.load_component("response_header") component = self.load_component("response_header" + self.prexix)
value["responses"]["200"]["headers"] = component["components"]["headers"] value["responses"]["200"]["headers"] = component["components"]["headers"]
return path, value return path, value