Choosing examples from open api specification for responses. #720

Closed
opened 2025-12-29 08:32:56 +01:00 by adam · 4 comments
Owner

Originally created by @PlatWalker on GitHub (Oct 8, 2025).

Originally assigned to: @StefH on GitHub.

Trying to setup some tests for twilio (https://github.com/twilio/twilio-oai) with their open api specification. I downloaded their oai, registered with wiremock method ".WithMappingFromOpenApiFile" everything goes smooth. Problem is that their oai has examples that I want to use. I can't find option to map those examples to wiremock, it seems there is only option to randomly generate values based on schema types? My only option is to read those examples with openapi reader and register desired options manually with ".RespondWith"?

Originally created by @PlatWalker on GitHub (Oct 8, 2025). Originally assigned to: @StefH on GitHub. Trying to setup some tests for twilio (https://github.com/twilio/twilio-oai) with their open api specification. I downloaded their oai, registered with wiremock method ".WithMappingFromOpenApiFile" everything goes smooth. Problem is that their oai has examples that I want to use. I can't find option to map those examples to wiremock, it seems there is only option to randomly generate values based on schema types? My only option is to read those examples with openapi reader and register desired options manually with ".RespondWith"?
adam added the feature label 2025-12-29 08:32:56 +01:00
adam closed this issue 2025-12-29 08:32:56 +01:00
Author
Owner

@PlatWalker commented on GitHub (Oct 8, 2025):

Okay I analized wiremock code, I know what is going on!

In method "OpenApiPathsMapper.MapOperationToMappingModel()", field "Example" from "Microsoft.OpenApi.Models.OpenApiMediaType" is used and not "Examples". Twilio oai is using "Examples".

Can I contribute and add option for choosing from multiple examples in PR? Or maybe I missed something and there is such option?

@PlatWalker commented on GitHub (Oct 8, 2025): Okay I analized wiremock code, I know what is going on! In method "OpenApiPathsMapper.MapOperationToMappingModel()", field "Example" from "Microsoft.OpenApi.Models.OpenApiMediaType" is used and not "Examples". Twilio oai is using "Examples". Can I contribute and add option for choosing from multiple examples in PR? Or maybe I missed something and there is such option?
Author
Owner

@StefH commented on GitHub (Oct 12, 2025):

@PlatWalker
I think this PR should fix it
https://github.com/wiremock/WireMock.Net/pull/1366

@StefH commented on GitHub (Oct 12, 2025): @PlatWalker I think this PR should fix it https://github.com/wiremock/WireMock.Net/pull/1366
Author
Owner

@StefH commented on GitHub (Oct 12, 2025):

@PlatWalker
You can try MyGet 1.14.0.
https://wiremock.org/dotnet/myget-preview-versions/

@StefH commented on GitHub (Oct 12, 2025): @PlatWalker You can try MyGet `1.14.0`. https://wiremock.org/dotnet/myget-preview-versions/
Author
Owner

@StefH commented on GitHub (Oct 22, 2025):

@PlatWalker
Did this fix your issue?

@StefH commented on GitHub (Oct 22, 2025): @PlatWalker Did this fix your issue?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/WireMock.Net#720