Skip to content

JsonApiDotNetCore.BaseJsonApiController<TResource, TIdentifier> not able to limit routes #1337

Closed as not planned
@bhavik-mittal

Description

@bhavik-mittal

I have created a custom controller Which inherits from BaseJsonApiController<> and i have overridden methods like GetAsync, GetById, PatchResource, PostResource. So while running the application getting error from swagger that says : An unhandled exception has occurred while executing the request. Swashbuckle.AspNetCore.SwaggerGen.SwaggerGeneratorException: Ambiguous HTTP method for action - Controllers.RaceController.GetSecondaryAsync. Actions require an explicit HttpMethod binding for Swagger/OpenAPI 3.0

Also, even if i use specific service then also it generates all the controller endpoints Example :

public class BaseController<TResource, TIdentifier> : BaseJsonApiController<TResource, TIdentifier> where TResource : class, IIdentifiable where TIdentifier : struct { public BaseController(IJsonApiOptions options, IResourceGraph resourceGraph, ILoggerFactory loggerFactory, IGetAllService<TResource, TIdentifier> getAllService) : base(options, resourceGraph, loggerFactory, getAllService) {

} }

Now in the above example it will create endpoints for PostAsync as well which it should not as per the documentation.

I wanted to get only the routes endpoint generated for those the methods has been overridden from the BaseJsonApiController but currently it is generating all the endpoints. I am using version 5.3.0 of JsonApiDotNetCore

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions