mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-01-11 21:10:32 +01:00
json from open api yaml #229
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 @hsnsalhi on GitHub (Dec 3, 2019).
Hello,
Is there a way to create json mapping from existing yaml OpenApi ?
Thank you
@StefH commented on GitHub (Dec 3, 2019):
No sorry, this is not yet possible. I had this idea before, but not yet implemented.
Maybe you can also think about this?
What needs to be done is just parsing the YML and generating an JSON with mappings.
@StefH commented on GitHub (Dec 3, 2019):
A possible option could be to use https://github.com/microsoft/OpenAPI.NET to deserialize the yml to an object (OpenApiDocument) and convert that to a MappingModel object
@hsnsalhi commented on GitHub (Dec 4, 2019):
How can I convert a OpenApiDocument to a MappingModel object ? is this possible with a WireMock helper or should I do it myself ?
@StefH commented on GitHub (Dec 4, 2019):
I'm working on some proto type code, I keep you informed.
@hsnsalhi commented on GitHub (Dec 4, 2019):
Ok thank you
@StefH commented on GitHub (Dec 4, 2019):
Should this code be added to WireMock?
Or a separate commandline application, or just a NuGet with a library?
@hsnsalhi commented on GitHub (Dec 5, 2019):
I think the best way is to add it as a feature in WireMock
I've started a try but this needs to be improved
@StefH commented on GitHub (Dec 5, 2019):
See this project:
https://github.com/WireMock-Net/WireMock.Net.OpenApiParser/tree/master/example/YamlDotNetConsoleApp/YamlDotNetConsoleApp
It currently supports reading a schema and creating dummy data. Or it also supports examples.
Some improvements need to be made like better dummy data for objects and more support for other types.
But it's a start.
@StefH commented on GitHub (Jul 7, 2020):
@hsnsalhi
I started a new project : https://github.com/WireMock-Net/WireMock.Net/tree/master/src/WireMock.Net.OpenApiParser
And you can try the console-app: https://github.com/WireMock-Net/WireMock.Net/tree/master/examples/WireMock.Net.OpenApiParser.ConsoleApp
In case you need more functionality, just create an issue.