I have a request model that inherits from a DTO. The request model overrides one of the DTO properties in order to decorate it with attributes which are specific to a request. This results in the API explorer display duplicate fields - one for the base DTO property and one for the property overridden in the request model. The property should only be rendered once by API explorer! Please confirm and advise fix ETA.
public class Movie
{
virtual public string MovieID { get; set; }
virtual public int MovieNo { get; set; }
virtual public string Name { get; set; }
virtual public string Description { get; set; }
}
Request DTO:
public class MoviePOSTRequest : SSTest.DTOs.Movie, IReturn<SSTest.DTOs.Movie>
{
[Input(Disabled = true)]
public override string MovieID { get; set; }
[Input(Disabled = true)]
public override int MovieNo { get; set; }
}
Thanks for the repro, this should now be resolved in the latest v6.0.3 release that’s now available on MyGet.
So you don’t have to create properties just to annotate them with [Input] attribute, I’ve added support for the [Field] class attribute you can annotate on Request DTOs with the property name to specify Input field properties, e.g. this is equivalent to your above DTO:
[Field(nameof(MovieID), Disabled = true)]
[Field(nameof(MovieNo), Disabled = true)]
public class MoviePOSTRequest : Movie, IReturn<Movie>
{
}
@Mythz - that only seems to work if I override the property. Adding the class decoration as you showed does not disable the field in the UI without also overriding the property in the inherited class.
This works:
[Field(nameof(MovieID), Disabled = true)]
[Field(nameof(MovieNo), Disabled = true)]
public class MoviePOSTRequest : Movie, IReturn<Movie>
{
public override string MovieID { get => base.MovieID; set => base.MovieID = value; }
public override string MovieNo { get => base.MovieNo; set => base.MovieNo = value; }
}
This does not:
[Field(nameof(MovieID), Disabled = true)]
[Field(nameof(MovieNo), Disabled = true)]
public class MoviePOSTRequest : Movie, IReturn<Movie>
{
}
Nope it never worked with a base class property since the missing property has to be hosted into the subclass which is now done in the latest v6.0.3 that’s now available on MyGet.
I’ve also improved the auto split casing text, given the upper casing property names I’m seeing a lot of. In v6.0.3 this should now look like: