0

I have a controller action that accepts data in the form of an array of objects (Complex object called ControlLinePointDto). For reasons described in my question and answer here, I read this into a JArray rather than a ControlLinePointDto[]. I do this in multiple places with different objects.

How can I change the documentation (NSwag) so that it is documented (including example) as a ControlLinePointDto[], rather than []?

[HttpPost("AddPoints")]
[ProducesResponseType(typeof(List<ControlLinePointDto>), 200)]
public async Task<IActionResult> AddPoints(int ControlLineId, [FromBody] JArray pointSetJson){
}
pushkin
  • 9,575
  • 15
  • 51
  • 95
statler
  • 1,322
  • 2
  • 15
  • 24

1 Answers1

0

You can change the docs type this way:

[JsonSchemaType(typeof(MyDto[]), FromBody] JArray array

https://github.com/RSuter/NJsonSchema/blob/master/src/NJsonSchema/Annotations/JsonSchemaTypeAttribute.cs#L19

Rico Suter
  • 11,548
  • 6
  • 67
  • 93