mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-01-12 05:20:35 +01:00
WithMappingFromOpenApiFile fails with exception when example item present in text-plain response in OAS contract #679
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @TomRom27 on GitHub (Apr 4, 2025).
Originally assigned to: @StefH on GitHub.
Description
OpenAPI content response can be of different types, plain text amongst others, like below:
Microsoft's OpenApiStreamReader imports it without any problem and thus we can see example item in this case is represented as simple string
But WithMappingFromOpenApiFile fails and raises exception:
"Error reading JObject from JsonReader. Current JsonReader item is not an object: String. Path '', line 1, position 28."
Looks like inside MapOperationToMappingModel it fails to handle the responseExample - if it is simple string.
Expected behavior
OAS contract with example item for text-plain can be used for mappings.
Test to reproduce
oas-content-example.json
Other related info
@StefH commented on GitHub (May 13, 2025):
https://github.com/wiremock/WireMock.Net/pull/1294
@StefH commented on GitHub (May 13, 2025):
@TomRom27
Can you retry with latest version?
@TomRom27 commented on GitHub (May 14, 2025):
Sure I will.
Thx a lot!
@TomRom27 commented on GitHub (May 14, 2025):
I checked and it works.
Thx a lot!