Swagger data source, class generation bug [BUG]

Hi again!

I found another bug and this time it has to do with the code generation from Swagger datasource.
So i have a rest Swagger data source that return big object with alot of information. The object return have some properties that are just string / bool / int and it has some properties that are IEnumerable (Array). But it also have other properties that are an object with properties.

So to the bug. The generated class from this swagger operation is not generataed correctly. All of the normal properties (int, string, bool and IEnumerable) are generatde correctly but properties that are an object is not generatade in the code. Let me show you how its done.

This a part of what the object in JSON looks like on the Swagger page.

And this is the same part generatade in code.

As you see there is some stuff missing like "mainAdress" and "mainContact" and as you can see in the generated code there is 3 rows between "Status" and "AccountReference". There should only be 1 rows just like between "InternalId" and "Number". So with that said it know there should be something there.

Just to clear some things. I have not touched any of the generatade code and this is how it came from adding a Swagger Datasource.

Thanks!

Hi @Gottegubben ,

Indeed Radzen does not support such 'inline' objects at the moment. It is complicated to 'guess' their type correctly (what should their class name be for example?). A possible solution is to add a partial class and extend the model. Something like:

public class ParentRecord
{
    public string Number { get; set; }
    public string Name { get; set; }
}

public partial class CustomerDto
{
    [JsonProperty("parentRecord")]
    public ParentRecord ParentRecord { get; set; }
}
1 Like