Skip to content

When removing #3

@srpeirce

Description

@srpeirce

Incorrectly showing V1 in Swagger when explicitly removed from a verson, and changing the start version.

e.g. only v2 and v3 should be accessable

            services.AddApiVersioning(options =>
            {
                options.Conventions = new IntroducedApiVersionConventionBuilder(2, 3);
                options.ReportApiVersions = true;
            });
            services.AddVersionedApiExplorer(
                options =>
                {
                    options.GroupNameFormat = "'v'VVV";
                    options.SubstituteApiVersionInUrl = true;
                });

But this is showing as V1 still

    [ApiController]
    [Route("api/v{api-version:apiVersion}/events/{eventId}/media")]
    [IntroducedInApiVersion(1)]
    [RemovedAsOfApiVersion(2)]
    [ResponseCache(CacheProfileName = CacheProfileNames.None)]
    public class MediaController : Controller
    {
        private readonly IMediaService _mediaService;

        public MediaController(IMediaService mediaService)
        {
            _mediaService = mediaService;
        }

        [HttpGet]
        public async Task<ActionResult<MediaV1[]>> Get(string eventId)
        {
            var media = (await _mediaService.GetForEventAsync(eventId))
                .Select(m => MediaV1.MapFrom(m, true, false))
                .ToArray();

            return media;
        }
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions