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.61k stars 1.08k forks source link

Create exceptions from local OpenAPI Specification #818

Closed chrisatrotter closed 4 years ago

chrisatrotter commented 4 years ago

Describe the feature request Create expectation from OpenAPI specification from local file path. Use a OpenAPI specification as the initializerJson.json.

What you are trying to do I am running a Mockserver docker container with initializerJson.json loaded to it. The initializerJson.json are expectations which I create from a OpenAPI specification that I have locally in my file path. The OpenAPI specification I am working with is public, but has to be downloaded rather than fetched from a URL which makes it problematic if there is only support for fetching by "specUrlOrPayload". If I were to download and store then OpenAPI specification in my private repository and create expectations by url, then I can't test this locally first simply by doing a "curl" such as show in the documentation.

The solution you'd like Allow creation of expectations from OpenAPI specification stored in local file path. Allow initializerJson.json to be based of an OpenAPI specification.

Describe alternatives you've considered For the moment, I have uploaded the OpenAPI specification to my own Github and created exceptions from my public repository url.

jamesdbloom commented 4 years ago

I'm not sure I understand what you problem is? Are you saying this example does not work inside docker https://mock-server.com/mock_server/using_openapi.html#button_open_api_filepath

chrisatrotter commented 4 years ago

Seems like when I try to create expectations from the OpenAPI specification I have in my local file path with example

curl -v -X PUT "http://localhost:1080/mockserver/openapi" -d '{
    "specUrlOrPayload": "file:/Users/hi/example/OpenAPISpecification.json"
}

Then I get the following error:

mockServer_1  |  error:
mockServer_1  |
mockServer_1  |   Unable to load API spec from provided URL or payload
mockServer_1  |
mockServer_1  | java.lang.IllegalArgumentException: Unable to load API spec from provided URL or payload
mockServer_1  |     at org.mockserver.openapi.OpenAPIConverter.buildOpenAPI(OpenAPIConverter.java:72)
mockServer_1  |     at org.mockserver.openapi.OpenAPIConverter.buildExpectations(OpenAPIConverter.java:46)
mockServer_1  |     at org.mockserver.mock.HttpState.add(HttpState.java:162)
mockServer_1  |     at org.mockserver.mock.HttpState.handle(HttpState.java:507)
mockServer_1  |     at org.mockserver.netty.HttpRequestHandler.channelRead0(HttpRequestHandler.java:90)
mockServer_1  |     at org.mockserver.netty.HttpRequestHandler.channelRead0(HttpRequestHandler.java:46)
mockServer_1  |     at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:99)
mockServer_1  |     at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
mockServer_1  |     at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
mockServer_1  |     at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
mockServer_1  |     at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:436)
mockServer_1  |     at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103)
mockServer_1  |     at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:251)
mockServer_1  |     at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
mockServer_1  |     at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
mockServer_1  |     at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
mockServer_1  |     at org.mockserver.dashboard.DashboardWebSocketHandler.channelRead(DashboardWebSocketHandler.java:138)
mockServer_1  |     at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
mockServer_1  |     at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
mockServer_1  |     at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
mockServer_1  |     at org.mockserver.closurecallback.websocketregistry.CallbackWebSocketServerHandler.channelRead(CallbackWebSocketServerHandler.java:56)
mockServer_1  |     at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
mockServer_1  |     at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
mockServer_1  |     at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
mockServer_1  |     at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103)
mockServer_1  |     at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
mockServer_1  |     at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
mockServer_1  |     at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
mockServer_1  |     at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103)
mockServer_1  |     at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
mockServer_1  |     at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
mockServer_1  |     at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
mockServer_1  |     at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:436)
mockServer_1  |     at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:324)
mockServer_1  |     at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:296)
mockServer_1  |     at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:251)
mockServer_1  |     at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
mockServer_1  |     at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
mockServer_1  |     at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
mockServer_1  |     at org.mockserver.netty.unification.PortUnificationHandler.switchToHttp(PortUnificationHandler.java:258)
mockServer_1  |     at org.mockserver.netty.unification.PortUnificationHandler.decode(PortUnificationHandler.java:138)
mockServer_1  |     at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:501)
mockServer_1  |     at io.netty.handler.codec.ReplayingDecoder.callDecode(ReplayingDecoder.java:366)
mockServer_1  |     at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:276)
mockServer_1  |     at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
mockServer_1  |     at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
mockServer_1  |     at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
mockServer_1  |     at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
mockServer_1  |     at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
mockServer_1  |     at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
mockServer_1  |     at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
mockServer_1  |     at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:163)
mockServer_1  |     at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:714)
mockServer_1  |     at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:650)
mockServer_1  |     at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:576)
mockServer_1  |     at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493)
mockServer_1  |     at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
mockServer_1  |     at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
mockServer_1  |     at java.base/java.lang.Thread.run(Thread.java:834)

It might be that I am doing something wrong here, but it seems from the documentation that you only allow creation of expectations from OpenAPI specifications if they come from a remote URL?

jamesdbloom commented 4 years ago

Have you definitely mapped in the volume for directory /Users/hi/example/OpenAPISpecification.json? It seems like the most likely issue is that the file system inside your docker container doesn't have a file at that location. Can you please provide more details about how you have mapped in that directory, for example show me the command you have used to run your docker container.

jamesdbloom commented 4 years ago

The following is an example that works for loading a local OpenAPI specification:

{
    "specUrlOrPayload": "file:/Users/jamesbloom/git/mockserver/mockserver/mockserver-core/src/test/resources/org/mockserver/mock/openapi_petstore_example.json",
    "operationsAndResponses": {
        "showPetById": "200",
        "createPets": "500"
    }
}
chrisatrotter commented 4 years ago

You were totally right about the mapping in the volume directory. I noticed that the mapping of the specification was not mapped correctly in the docker container. Thank you for helping me with this issue. I really appreciate the time you have taken to help me solve my misunderstanding. Sorry again for the inconvenience. Keep up the awesome work with the project! 😄

jamesdbloom commented 4 years ago

I'm glad you managed to resolve you issues.

michalmoravek commented 3 years ago

@chrisatrotter Nice. And please... how to map volume directory correctly? I'm not able to find it in documentation :-(

chrisatrotter commented 3 years ago

@michalmoravek , Sorry for the late response and I hope it is not to late, but the correct way of mapping the volume directory was shown by @jamesdbloom above ⬆️ Have a look at the example he provided and see if you're able to map it to the volume directory correctly 👍

{
    "specUrlOrPayload": "file:/Users/jamesbloom/git/mockserver/mockserver/mockserver-core/src/test/resources/org/mockserver/mock/openapi_petstore_example.json",
    "operationsAndResponses": {
        "showPetById": "200",
        "createPets": "500"
    }
}

Let me know if there is anything else I can assist you with.

shashankSkydale commented 5 months ago

@jamesdbloom & @chrisatrotter - Can you guys help me on how to map the volume directory which somehow is not clear or evident in your previous comments ?

shashankSkydale commented 5 months ago

Hi @jamesdbloom I'm getting below error , i'm running mock-server as standalone jar instead of docker container

java.lang.IllegalArgumentException: Unable to load API spec, Unable to read locationfile:C:/Users/shashank agarwal/swagger.yml at org.mockserver.openapi.OpenAPIParser.buildOpenAPI(OpenAPIParser.java:79) at org.mockserver.openapi.OpenAPIConverter.buildExpectations(OpenAPIConverter.java:39) at org.mockserver.mock.HttpState.add(HttpState.java:247) at org.mockserver.mock.HttpState.handle(HttpState.java:618) at org.mockserver.netty.HttpRequestHandler.channelRead0(HttpRequestHandler.java:96) at org.mockserver.netty.HttpRequestHandler.channelRead0(HttpRequestHandler.java:48) at shaded_package.io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:99) at shaded_package.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) at shaded_package.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) at shaded_package.io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) at shaded_package.io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:436) at shaded_package.io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103) at shaded_package.io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:251) at shaded_package.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) at shaded_package.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) at shaded_package.io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) at org.mockserver.dashboard.DashboardWebSocketHandler.channelRead(DashboardWebSocketHandler.java:137) at shaded_package.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) at shaded_package.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) at shaded_package.io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) at org.mockserver.netty.websocketregistry.CallbackWebSocketServerHandler.channelRead(CallbackWebSocketServerHandler.java:57) at shaded_package.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) at shaded_package.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) at shaded_package.io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) at shaded_package.io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103) at shaded_package.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) at shaded_package.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) at shaded_package.io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) at shaded_package.io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103) at shaded_package.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) at shaded_package.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) at shaded_package.io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) at shaded_package.io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103) at shaded_package.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) at shaded_package.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) at shaded_package.io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) at shaded_package.io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:436) at shaded_package.io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:327) at shaded_package.io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:299) at shaded_package.io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:251) at shaded_package.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) at shaded_package.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) at shaded_package.io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) at org.mockserver.netty.unification.PortUnificationHandler.switchToHttp(PortUnificationHandler.java:279) at org.mockserver.netty.unification.PortUnificationHandler.decode(PortUnificationHandler.java:153) at shaded_package.io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:510) at shaded_package.io.netty.handler.codec.ReplayingDecoder.callDecode(ReplayingDecoder.java:366) at shaded_package.io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:279) at shaded_package.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) at shaded_package.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) at shaded_package.io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) at shaded_package.io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410) at shaded_package.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) at shaded_package.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) at shaded_package.io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919) at shaded_package.io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166) at shaded_package.io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:722) at shaded_package.io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:658) at shaded_package.io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:584) at shaded_package.io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:496) at shaded_package.io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997) at shaded_package.io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) at java.base/java.lang.Thread.run(Thread.java:833) Caused by: java.lang.NullPointerException: Cannot invoke "java.util.Collection.toArray()" because "c" is null at java.base/java.util.ArrayList.addAll(ArrayList.java:670) at org.mockserver.openapi.OpenAPIParser.buildOpenAPI(OpenAPIParser.java:68) ... 62 more 05-24 13:20:42.380 SERVER_CONFIGURATION

chrisatrotter commented 5 months ago

Hi @jamesdbloom I'm getting below error , i'm running mock-server as standalone jar instead of docker container

java.lang.IllegalArgumentException: Unable to load API spec, Unable to read locationfile:C:/Users/shashank agarwal/swagger.ymlat org.mockserver.openapi.OpenAPIParser.buildOpenAPI(OpenAPIParser.java:79) at org.mockserver.openapi.OpenAPIConverter.buildExpectations(OpenAPIConverter.java:39) at org.mockserver.mock.HttpState.add(HttpState.java:247) at org.mockserver.mock.HttpState.handle(HttpState.java:618) at org.mockserver.netty.HttpRequestHandler.channelRead0(HttpRequestHandler.java:96) at org.mockserver.netty.HttpRequestHandler.channelRead0(HttpRequestHandler.java:48) at shaded_package.io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:99) at shaded_package.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) at shaded_package.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) at shaded_package.io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) at shaded_package.io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:436) at shaded_package.io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103) at shaded_package.io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:251) at shaded_package.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) at shaded_package.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) at shaded_package.io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) at org.mockserver.dashboard.DashboardWebSocketHandler.channelRead(DashboardWebSocketHandler.java:137) at shaded_package.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) at shaded_package.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) at shaded_package.io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) at org.mockserver.netty.websocketregistry.CallbackWebSocketServerHandler.channelRead(CallbackWebSocketServerHandler.java:57) at shaded_package.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) at shaded_package.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) at shaded_package.io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) at shaded_package.io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103) at shaded_package.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) at shaded_package.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) at shaded_package.io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) at shaded_package.io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103) at shaded_package.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) at shaded_package.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) at shaded_package.io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) at shaded_package.io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103) at shaded_package.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) at shaded_package.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) at shaded_package.io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) at shaded_package.io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:436) at shaded_package.io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:327) at shaded_package.io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:299) at shaded_package.io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:251) at shaded_package.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) at shaded_package.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) at shaded_package.io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) at org.mockserver.netty.unification.PortUnificationHandler.switchToHttp(PortUnificationHandler.java:279) at org.mockserver.netty.unification.PortUnificationHandler.decode(PortUnificationHandler.java:153) at shaded_package.io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:510) at shaded_package.io.netty.handler.codec.ReplayingDecoder.callDecode(ReplayingDecoder.java:366) at shaded_package.io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:279) at shaded_package.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) at shaded_package.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) at shaded_package.io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) at shaded_package.io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410) at shaded_package.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) at shaded_package.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) at shaded_package.io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919) at shaded_package.io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166) at shaded_package.io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:722) at shaded_package.io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:658) at shaded_package.io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:584) at shaded_package.io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:496) at shaded_package.io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997) at shaded_package.io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) at java.base/java.lang.Thread.run(Thread.java:833) Caused by: java.lang.NullPointerException: Cannot invoke "java.util.Collection.toArray()" because "c" is null at java.base/java.util.ArrayList.addAll(ArrayList.java:670) at org.mockserver.openapi.OpenAPIParser.buildOpenAPI(OpenAPIParser.java:68) ... 62 more 05-24 13:20:42.380 SERVER_CONFIGURATION

It seems from the error message that it is not taking into consideration the "Windows setup" with the C: file system. As a temporary solution, if you containerise instead of having it as a standalone, then it will work as was described above. Use Docker with a Unix based file system and it should work as expected.

shashankSkydale commented 5 months ago

Hi @chrisatrotter @jamesdbloom

Even with petstore open api specification json file which is provided as example to generate expectation still unable to generate the same getting below error, kindly assist

`java.lang.IllegalArgumentException: incorrect openapi expectation json format for: "{specUrlOrPayload:https://raw.githubusercontent.com/mock-server/mockserver/master/mockserver-integration-testing/src/main/resources/org/mockserver/openapi/openapi_petstore_example.json}" schema validation errors: 1 error: