Closed
Description
Description
Explicitly setting a pluralized type name for a resource doesn't work for routing purposes. Example:
var mvcBuilder = services.AddMvcCore();
services.AddJsonApi(options => {
options.Namespace = "api/v1";
}, resources: resources => {
resources.AddResource<TodoResource, Guid>(pluralizedTypeName: "todos");
});
services.AddScoped<IResourceService<TodoResource, Guid>, TodoResourceService>();
Controller is defined as follows
public sealed class TodoController : JsonApiController<TodoResource, Guid>
{
public TodoController(
IJsonApiOptions jsonApiOptions,
ILoggerFactory loggerFactory,
IResourceService<TodoResource, Guid> resourceService)
: base(jsonApiOptions, loggerFactory, resourceService)
{
}
}
But when trying to call the API it seems the respective controller is still registered at /api/v1/todoResources instead of /ap1/v1/todos
curl -I -X GET http://localhost:5001/api/v1/todos
HTTP/1.1 404 Not Found
Date: Sun, 28 Jun 2020 19:14:46 GMT
Server: Kestrel
Content-Length: 0
curl -I -X GET http://localhost:5001/api/v1/todoResources
HTTP/1.1 200 OK
Date: Sun, 28 Jun 2020 19:13:15 GMT
Content-Type: application/vnd.api+json
Server: Kestrel
Transfer-Encoding: chunked
Environment
- JsonApiDotNetCore Version: 4.0.0-alpha5
- Other Relevant Package Versions:
Metadata
Metadata
Assignees
Labels
No labels