-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
👁 should-enhancehas something needs to enhance but implement it in other PRshas something needs to enhance but implement it in other PRs
Description
It should refactor to use trusty third-party library, e.g., swagger-parser, so it could parse any format Swagger API configuration which follows the standard rule.
It should not parse the Swagger API configuration by the implementation with hard-code. Below are some example about the bad implementation but truly exists in source code:
- About parsing entire APIs
# Other code
apis: dict = data["paths"]
for api_path, api_props in apis.items():
for one_api_http_method, one_api_details in api_props.items():
api = API().deserialize(data=one_api_details)
api.path = api_path
api.http_method = one_api_http_method
self.paths.append(api)
tags: List[dict] = data.get("tags", [])
self.tags = list(map(lambda t: Tag().deserialize(t), tags))
# Other code- About parsing API parameter
self.name = handled_data["name"]
self.required = handled_data["required"]
self.value_type = convert_js_type(handled_data["type"])
self.default = handled_data.get("default", None)
items = handled_data.get("items", None)- About parsing tag
self.name = data["name"]
self.description = data["description"]This task be divided as 4 sub-tasks:
Metadata
Metadata
Assignees
Labels
👁 should-enhancehas something needs to enhance but implement it in other PRshas something needs to enhance but implement it in other PRs