muonsoft / openapi-mock

OpenAPI mock server with random data generation
MIT License
487 stars 55 forks source link

curl results in a 404 Not Found #47

Open slecholineas opened 4 years ago

slecholineas commented 4 years ago

I'm able to start openapi-mock with openapi-mock.exe serve --specification-url customers-v1.0.0-openapi3.yaml and the attached YAML. "curl http://localhost:8080/financial/v1/customers/XP" results however in a "404 Not Found". What am I doing wrong ?

customers-v1.0.0-openapi3.yaml.txt

strider2038 commented 4 years ago

@slecholineas thank you for the report! You can see details about the error in logs.

Route 'GET /financial/v1/customers/XP' does not pass validation: Parameter 'modifiedSince' in query has an error: must have a value: must have a value

It seems that the query parameter modifiedSince is required for URL.

- in: query
  name: modifiedSince
  required: true

If you send curl http://localhost:8080/financial/v1/customers/XP?modifiedSince=2020-01-01T00:00:00 you will see the correct response from the server.

I think that the server should respond with "400 Bad request". I will fix this behaviour.

slecholineas commented 4 years ago

@strider2038 now it works, thanks for your help.

ahofmeister commented 2 years ago

@strider2038 As far as I know, if a query parameter was misspelled or something similar, a 404 is correct. See: https://stackoverflow.com/questions/51676598/http-404-vs-400-for-invalid-query-parameters

jkone27 commented 1 year ago

i get just 404s without much reasons on why it cannot match, also it would be useful if the mock server loaded in it's root page or in some logs, all the loaded configurations and available paths from root that can be called and methods that can be used..