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)
self.name = data["name"]
self.description = data["description"]
This task be divided as 4 sub-tasks:
- Estimate which library is trusty to use for refactoring (sub-task)
- Check the test could cover all the features of refactoring (sub-task)
- Refactor the implementation (sub-task)
- Prepare the release note (sub-task)
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:
This task be divided as 4 sub-tasks: