PTV2 Profile json and xml generation from code
Posted: Wed Mar 02, 2022 7:16 pm
Hi,
we are using ptv2 with csharp REST client (generated with NSwagCSharp code generator from the OpenApiReference).
This way we get the csharp object model of the RequestProfile class tree, annotated for json conversion.
But periodically we would like to generate from the most frequent settings a stored profile as well, which requires xml format as far as we know.
We tried to run xml serialization simply on the csharp objects mentioned above, but run into casing and other incompatibilities.
We worked this around by generating another csharp class tree from the profile xsd as well, which is xml annotated properly and mapping the two with a csharp object mapper library, AgileMapper.
Out tests show, that is is actually working now, but we wonder if there is an easier way, where we can use the same csharp profile object to generate both the json profile for the API and the xml profile for the storedProfile files without object mapping?
Best regards,
Tibor
we are using ptv2 with csharp REST client (generated with NSwagCSharp code generator from the OpenApiReference).
This way we get the csharp object model of the RequestProfile class tree, annotated for json conversion.
But periodically we would like to generate from the most frequent settings a stored profile as well, which requires xml format as far as we know.
We tried to run xml serialization simply on the csharp objects mentioned above, but run into casing and other incompatibilities.
We worked this around by generating another csharp class tree from the profile xsd as well, which is xml annotated properly and mapping the two with a csharp object mapper library, AgileMapper.
Out tests show, that is is actually working now, but we wonder if there is an easier way, where we can use the same csharp profile object to generate both the json profile for the API and the xml profile for the storedProfile files without object mapping?
Best regards,
Tibor