mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-01-11 21:10:32 +01:00
Response Templating examples #362
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 @devmariodiaz on GitHub (Oct 5, 2021).
Hello Stef,
I hope that is doing well.
I am trying to use Response Templating features from this amazing library, but for me is not working, I don't know if my code is bad, is possible that you could provide me some examples to do that?
This is my example:
Getting this result:
shorturl.at/yRVW1
@StefH commented on GitHub (Oct 5, 2021):
The shorturl is invalid?
And can you please add the request ?
@devmariodiaz commented on GitHub (Oct 5, 2021):
Sure Stef, thanks for your fast answer, the request is:
this is using Postman
{
"name": "Mario"
}
Getting this result:
{
"Status": "Value cannot be null. (Parameter 'value')"
}
@StefH commented on GitHub (Oct 5, 2021):
.UsingGet()should be.UsingPost()This works:

@devmariodiaz commented on GitHub (Oct 5, 2021):
Thanks a lot, Stef.
I appreciate it. I checked it and it works. Could you please provide some examples using this feature?
In my case, I want to replace static variables in the canned data, and other use cases.
Also, could you please let me know, which version of RAML, is supported by WireMock.NET, I check the RAML version 1.0, JSON schema version 3.0, and it worked, my question is regarding other versions and other formats available.
I also tried to create an array and use this out-of-the-box setting feature "settings.NumberOfArrayItems = 5;",
but I was not able to create an array in RAML v1.0 JSON schema 4, here is the RAML code that I used and it is compiling with an error:
I need to implement almost all functionalities from WireMock.net to build a kind of mocking framework using RAML, JSON, XML, SOAP, etc. I will appreciate it.
Thanks for your support, WireMock .net is truly amazing.
@StefH commented on GitHub (Oct 5, 2021):
For templates, read all the text + follow links on : https://github.com/WireMock-Net/WireMock.Net/wiki/Response-Templating
About RAML : I use some standard libraries from Microsoft:
<PackageReference Include="Microsoft.OpenApi.Readers" Version="1.2.3" />If have more questions on RAML/Openapi : create a new issue.