Generating mappings from Payroc open-api file gives ArgumentException: Property with the same name already exists on object #609

Closed
opened 2025-12-29 15:28:10 +01:00 by adam · 10 comments
Owner

Originally created by @Cherepoc on GitHub (Jun 12, 2024).

Originally assigned to: @StefH on GitHub.

Hi!
I'm trying to use WireMock for testing my Payroc integration. There's an open-api file I thought I could use to generate the client mock, but when I use WithMappingFromOpenApiFile method, it gives me the following error:

Unhandled exception. System.ArgumentException: Can not add property orderId to Newtonsoft.Json.Linq.JObject. Property with the same name already exists on object.

I used several tools to generate the C# client classes from the very same open-api file, and all of them succeeded and did not have any critical errors.
The open-api file
Example on dotnet fiddle
Hope this can be fixed. Thanks!

Originally created by @Cherepoc on GitHub (Jun 12, 2024). Originally assigned to: @StefH on GitHub. Hi! I'm trying to use WireMock for testing my Payroc integration. There's an open-api file I thought I could use to generate the client mock, but when I use WithMappingFromOpenApiFile method, it gives me the following error: ``` Unhandled exception. System.ArgumentException: Can not add property orderId to Newtonsoft.Json.Linq.JObject. Property with the same name already exists on object. ``` I used several tools to generate the C# client classes from the very same open-api file, and all of them succeeded and did not have any critical errors. [The open-api file](https://raw.githubusercontent.com/payroc/api-specs/main/payroc-openapi-spec.yaml) [Example on dotnet fiddle](https://dotnetfiddle.net/evvKwS) Hope this can be fixed. Thanks!
adam added the bug label 2025-12-29 15:28:10 +01:00
adam closed this issue 2025-12-29 15:28:10 +01:00
Author
Owner

@StefH commented on GitHub (Jun 19, 2024):

https://github.com/WireMock-Net/WireMock.Net/pull/1122

@StefH commented on GitHub (Jun 19, 2024): https://github.com/WireMock-Net/WireMock.Net/pull/1122
Author
Owner

@StefH commented on GitHub (Jun 19, 2024):

@Cherepoc

Can you try preview version 1.5.58-ci-18736?

See
https://github.com/WireMock-Net/WireMock.Net/wiki/MyGet-preview-versions

@StefH commented on GitHub (Jun 19, 2024): @Cherepoc Can you try preview version `1.5.58-ci-18736`? See https://github.com/WireMock-Net/WireMock.Net/wiki/MyGet-preview-versions
Author
Owner

@StefH commented on GitHub (Jun 29, 2024):

@Cherepoc did you have time to test this version?

@StefH commented on GitHub (Jun 29, 2024): @Cherepoc did you have time to test this version?
Author
Owner

@StefH commented on GitHub (Jul 3, 2024):

@Cherepoc did you have time to test this version?

@StefH commented on GitHub (Jul 3, 2024): @Cherepoc did you have time to test this version?
Author
Owner

@Cherepoc commented on GitHub (Jul 6, 2024):

@StefH Thanks! I'll test it in a few days.

@Cherepoc commented on GitHub (Jul 6, 2024): @StefH Thanks! I'll test it in a few days.
Author
Owner

@Cherepoc commented on GitHub (Jul 16, 2024):

@StefH Sorry for the delay. The error is still there
EDIT. Actually that version is not available anymore. I've tried other ones, they still give me error.

@Cherepoc commented on GitHub (Jul 16, 2024): @StefH Sorry for the delay. The error is still there EDIT. Actually that version is not available anymore. I've tried other ones, they still give me error.
Author
Owner

@StefH commented on GitHub (Jul 16, 2024):

I will create a new preview version tomorrow.

@StefH commented on GitHub (Jul 16, 2024): I will create a new preview version tomorrow.
Author
Owner

@StefH commented on GitHub (Jul 17, 2024):

@Cherepoc
Can you try preview 1.5.60-ci-18958?

@StefH commented on GitHub (Jul 17, 2024): @Cherepoc Can you try preview 1.5.60-ci-18958?
Author
Owner

@Cherepoc commented on GitHub (Jul 22, 2024):

@StefH Just tried it and now it works. Thanks!

@Cherepoc commented on GitHub (Jul 22, 2024): @StefH Just tried it and now it works. Thanks!
Author
Owner

@StefH commented on GitHub (Jul 22, 2024):

https://github.com/WireMock-Net/WireMock.Net/pull/1122

@StefH commented on GitHub (Jul 22, 2024): https://github.com/WireMock-Net/WireMock.Net/pull/1122
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/WireMock.Net-wiremock#609