python-wiremock icon indicating copy to clipboard operation
python-wiremock copied to clipboard

better support for typing

Open talarari opened this issue 5 years ago • 3 comments
trafficstars

first of all love the client, really makes working with wiremock in python simple. :)

would be great if if the models for the library were typed more strongly, for autocomplete and all the other beneifits. so instead of doing


@add_metaclass(BaseEntityMetaType)
class RequestResponseDefinition(BaseAbstractEntity):
    status = JsonProperty("status")
    transformers = JsonProperty("transformers", klass=list)
    from_configured_stub = JsonProperty("fromConfiguredStub")  # will be true/false
    transformer_parameters = JsonProperty("transformerParameters", klass=dict)

would be


class RequestResponseDefinition(BaseAbstractEntity):
    status = str
    transformers = List[Transformer] 
    from_configured_stub = bool
    transformer_parameters = dict[TransformerPrameter]

this can be achieved either with dataclasses or any other way (pydantic models, attr , etc)

talarari avatar Nov 08 '20 12:11 talarari

PR's welcome now that PY2 is EOL :)

platinummonkey avatar Nov 09 '20 15:11 platinummonkey

will be picking this up :) have some openapi specs for which to work off :)

platinummonkey avatar Oct 22 '21 16:10 platinummonkey

Hello!

If proper typing is coming i suggest making it mypy compatible , if that wasn't already the plan :)

lindycoder avatar Jan 26 '22 22:01 lindycoder