mock-server / mockserver

MockServer enables easy mocking of any system you integrate with via HTTP or HTTPS with clients written in Java, JavaScript and Ruby. MockServer also includes a proxy that introspects all proxied traffic including encrypted SSL traffic and supports Port Forwarding, Web Proxying (i.e. HTTP proxy), HTTPS Tunneling Proxying (using HTTP CONNECT) and SOCKS Proxying (i.e. dynamic port forwarding).
http://mock-server.com
Apache License 2.0
4.58k stars 1.07k forks source link

Missing required reponse property of type string format byte #1788

Open camproto opened 1 year ago

camproto commented 1 year ago

Describe the issue Default reponse miss property of type string format byte.

Returned reponse is not valid and consumer crashed.

What you are trying to do I have a yml with a reponse in which one property is mandatory and of type: string, format: byte. The request is matched and a response is returned, but this required property is not included, which is clearly seen in the UI and in the log.

MockServer version mockserver-netty-no-dependencies 5.15.0

To Reproduce OAS with required property of type: string, format: byte.

In Java main method: ClientAndServer.startClientAndServer(PORT) .upsert( openAPIExpectation("the.yaml"));

Expected behaviour Return a default byte array (base64 encoded).

I tried example: "VG9sbE5vd0Jld2Vpc21pdHRlbA==", but the property is still not within the response.

MockServer Log no log error, requests matching expectation and response retured.

camproto commented 1 year ago

The property will be even not included in reponse, if there is a valid string as example: given in the spec yaml.

camproto commented 1 year ago

I had to switch because of this flaw to provide a complete response as json file, which is much less convenient - for one byte property. Would be really glad to the cool and short ClientAndServer.startClientAndServer(port) .upsert( openAPIExpectation(...))