meeshkan / hmt

HTTP Mocking Toolkit
MIT License
52 stars 7 forks source link

Allow specifying an OpenAPI spec file directly #135

Closed fornwall closed 4 years ago

fornwall commented 4 years ago

Using the command as meeshkan mock --specs spec_file.yaml is probably more natural and less to remember, especially as most people will probably (at least start with) mocking only one OpenAPI specification file.

We still support the --specs option to point at a directory just as before as well.

We also start validating the argument, so in the case of a non-existing specs, we show a descriptive error message instead of starting a mock server without any mocks:

$ meeshkan mock --specs non-existing
Usage: meeshkan mock [OPTIONS] COMMAND [ARGS]...
Try "meeshkan mock --help" for help.

Error: Invalid value for "-s" / "--specs": Path "non-existing" does not exist.

Ideally I think we should have have meeshkan mock spec_file.yaml without any options, but the daemon argument handling currently complicates that, so this is a start.

fornwall commented 4 years ago

Tests are failing due to meeshkan-examples containing an example without a specs. I can fix that example to add a spec, if we agree that we don't need to support running a mock without any spec.

ksaaskil commented 4 years ago

We could maybe consider making examples repo a git submodule to simplify changing both repos at the same time?

fornwall commented 4 years ago

Replaced by #154.