I am upgrading my .NET Core project from 2.2 to 3.1...
With that I also updated Swagger version, which is now based on OpenApi. The .json schema for my API I got from Swagger, has changed the $ref name for my custom generic types. I use these types in a lot of responses.
I am not sure if it is because of the OpenApi specification, or I haven't configured something right.
This is an example of my controller method:
/// <summary>
/// Gets recording sets by search settings.
/// </summary>
/// <response code="200">The recording sets were returned correctly.</response>
/// <response code="401">The unauthorized access.</response>
/// <response code="406">The not acceptable format.</response>
/// <response code="415">The unsupported media type.</response>
/// <response code="500">The unexpected error.</response>
/// <param name="recordingSetSearchSettings">The search settings of the recording set.</param>
/// <returns>The found recording sets.</returns>
[HttpGet]
[ProducesResponseType(typeof(IDataPage<RecordingSet>), StatusCodes.Status200OK)]
[ProducesResponseType(typeof(void), StatusCodes.Status401Unauthorized)]
[ProducesResponseType(typeof(void), StatusCodes.Status406NotAcceptable)]
[ProducesResponseType(typeof(void), StatusCodes.Status415UnsupportedMediaType)]
[ProducesResponseType(typeof(ApiErrorSummary), StatusCodes.Status500InternalServerError)]
[SwaggerOperation(OperationId = "SearchRecordingSets")]
public IDataPage<RecordingSet> Get([FromQuery(Name = "")] RecordingSetSearchSettings recordingSetSearchSettings)
{
return recordingSetService.Search(recordingSetSearchSettings);
}
Notice the IDataPage<RecordingSet>
in ProducesResponseType
This is how my $ref name in .json used to look like: IDataPage[RecordingSet]
(I want to maintain this, because I use custom NSwag .exe to generate Client methods for FrontEnd)
This is how the $ref name in .json looks now: RecordingSetIDataPage
Is this a configuration problem, or the specification changed, so I have to implement some custom approach in order to support this?