open-rpc / mock-server

Provides a mock JSON-RPC API given an OpenRPC document.
Apache License 2.0
26 stars 8 forks source link

Mocking examples with "paramStructure": "by-name" params #511

Closed GVHengy closed 3 years ago

GVHengy commented 3 years ago

Is your feature request related to a problem? Please describe. There are lack of examples with "paramStructure": "by-name". If we are trying to get different responses based on different params in Examples section we still recieve generated answer based on specified structure not the example result value.

Example Schema: openrpc.txt Request: ### "Currencies.Read" POST http://localhost:3333 Accept: */* Cache-Control: no-cache Content-Type: application/json { "id": 2, "jsonrpc": "2.0", "method": "Currencies.Read", "params": { "JWT": "asd.asd.asd", "Sorting": [ { "Field": "id", "Dir": "asc" } ] } } Response: { "id": 2, "jsonrpc": "2.0", "result": { "Data": [ { "id": 96211153, "name": "Duis qui magna ex dolor", "iso": "aute adipisicing Excepteur do" } ] } }

Expected result: we were expecting in result.Data array objects { "id": 1, "name": "USD", "iso": "USD" }, { "id": 2, "name": "EUR", "iso": "EUR" }

However - examples with params based on "paramStructure": "by-position" works well.

Describe the solution you'd like Please provide guides/examples in the documentation for such cases with mocking requests based on "paramStructure": "by-name" or fix the server behaviour in case it is a bug.

shanejonas commented 3 years ago

fixed in #520