alufers / mitmproxy2swagger

Automagically reverse-engineer REST APIs via capturing traffic
5.05k stars 217 forks source link

feature request: use `additionalProperties` for dicts with generic keys #147

Closed timvahlbrock closed 6 months ago

timvahlbrock commented 6 months ago

Currently, every object will be explicitly mapped out. However, sometimes the keys are generic and depending on the data of the user (e.g. when the keys are ids of some objects). In this case OpenAPIs additionalProperties option could be used instead. Detecting generic keys is not trivial not finally solvable, but some types of generic keys like numbers only or UUIDs could be easily detected.

I am willing to create a PR for this.

timvahlbrock commented 6 months ago

Started implementation in #148 , might need some refactoring to reduce duplication

timvahlbrock commented 6 months ago

@alufers removed the duplication by introducing testclient.py and testserver.py. When adding more implementations it probably would be useful to move the individual implementations to subfolders, but as far as my knowledge of python goes, this would require introduction of modularisation.

timvahlbrock commented 6 months ago

I guess this is released on pip with next minor version and on docker as soon as the pipeline is fixed?

timvahlbrock commented 6 months ago

@alufers do you have any plans for the point of the next release? As far as I can tell there is no "nightly" release channel or something similar, except the docker container?

timvahlbrock commented 6 months ago

As far as I can tell there is no "nightly" release channel or something similar, except the docker container?

Just realized pip can install from GitHub directly.