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.59k stars 1.07k forks source link

Error with OpenAPI: SEVERE Unable to load API spec... "style" is null for open api: #1318

Closed isla-nye closed 2 years ago

isla-nye commented 2 years ago

Describe the issue Using MockServer with an OpenApi Spec throws an error: SEVERE Unable to load API spec, Cannot invoke "shaded_package.io.swagger.v3.oas.models.parameters.Parameter$StyleEnum.ordinal()" because "style" is null for open api:

Result is that paths do not seem to be configured properly.

What you are trying to do Description of what you are trying to do so we can understand the context of the problem

MockServer version 5.13.2 (Tested and found that the issue did not occur with 5.12.0)

To Reproduce Steps to reproduce the issue: Create expectations with a valid OpenApi spec.

  1. How you are running MockServer (i.e maven plugin, docker, etc): Docker
  2. Code you used to create expectations: const createExpectationResponse = await mockServerClient( MOCK_SERVER_HOST, MOCK_SERVER_PORT, ).openAPIExpectation({ specUrlOrPayload: FILE_LOCATION, operationsAndResponses: { OperationId1: '201', OperationId2: '201', OperationId3: '200', },
  3. What error you saw SEVERE Unable to load API spec, Cannot invoke "shaded_package.io.swagger.v3.oas.models.parameters.Parameter$StyleEnum.ordinal()" because "style" is null for open api:

Expected behaviour No error to be thrown for "style" property not being present for parameters

oscargprocore commented 2 years ago

For what it's worth, this issue is also a pretty big problem for me and my teams, as we utilise OpenAPI Specs to generate mocks.

jamesgoodhouse commented 2 years ago

I am attempting to load specs for Azure and am running into the same problem.

jamesdbloom commented 2 years ago

Can you please provide the actual OpenAPI specification that is causing the problem so that I can reproduce this issue.

jamesdbloom commented 2 years ago

This has now been reproduced and fixed