Skip to content

ApiController generator fails to handle parameters in controller base route declaration #36

Closed
@joachim-heck

Description

@joachim-heck

Hey Kai, seems like I discovered bit of an edge case bug in the ApiController service generator ;-D
It only happens when I'm trying to put a parameter on every endpoint route for a specific controller.... If I move the parameter to every endpoint route, the generator builds the correct routes.

[Route("api/devices/{deviceUid}")]
[GenerateAngularService(Generator.GeneratorServiceOutputPath, Generator.GeneratorModelPath, "{0}ApiService")]
[GenerateIgnoreGeneric(typeof(Response<>))]
public class DeviceController : ControllerBase
....

Any endpoint on this controller will be generated to something like:
this.http.get<boolean>(this.serviceUrl + "/api/devices/{deviceUid}/data" + "?deviceUid=" + this.convertAny(deviceUid), httpOptions).subscribe((result) => {...

which correctly should be:
this.http.get<boolean>(this.serviceUrl + "/api/devices/" + deviceUid + "/data", httpOptions).subscribe((result) => {

without the additional {deviceUid}

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingnext releaseTry to add this issue to next release

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions