When generating a page for a model with two differently named fields but pointing to the same model, the outputted generated Angular component is invalid due to duplicated lookup properties.
See below for invalid output:
export abstract class AbstractGradeAlternateDetailViewService {
protected readonly fb = inject(FormBuilder);
protected readonly track = inject(TrackByService);
public readonly proxyService = inject(GradeAlternateService);
public readonly list = inject(ListService);
public readonly getGradeLookup = this.proxyService.getGradeLookup;
// The below line is being doubled up-- either we need a way to rename the property to something different or the outputted code shouldn't duplicate it a second time
// The fix workaround now is to just manually delete the below line but this change will get overwritten if the file is ever re-generated
public readonly getGradeLookup = this.proxyService.getGradeLookup;
...
}
Cause appears to be because we have two navigation properties pointing to the same model (Grade); however, this is valid C# as one of the property names is for GradeId and the other is for ParentGradeId:
I am using the CRUD Page Generator to produce models and it appears that the generated output is expecting the proxy path for the Angular service to be under a "controllers" folder; however, they are being generated just in the root HttpApi project instead. This error sounds very similar to issue reported in 2021: https://github.com/abpframework/abp/issues/9904
// Generated path below:
import { WorkAreaService } from '../../../proxy/core/controllers/work-areas/work-area.service';
// Correct path that it should be:
import { WorkAreaService } from '../../../proxy/core/work-areas/work-area.service';
export abstract class AbstractWorkAreaViewService {
protected readonly proxyService = inject(WorkAreaService);
protected readonly confirmationService = inject(ConfirmationService);
protected readonly list = inject(ListService);
data: PagedResultDto<WorkAreaDto> = {
items: [],
totalCount: 0,
};
filters = {} as GetWorkAreasInput;
delete(record: WorkAreaDto) { ... }
hookToQuery() { ... }
clearFilters() { ... }
}
Not sure if the WorkArea should be under Core.Http > Controllers > WorkAreas
but when the CRUD generator is run (and re-run), it's placing the WorkArea controller service under Core.Http > WorkAreas
:
Hi, we're seeing the same issue as reported here for the latest version of ABP (stable and preview versions) and Angular 18: https://abp.io/support/questions/7489/Proxy-generation-gives-Error-for-type-EntityAngular
Output on generating the proxy produces an invalid volo models.ts file:
export interface AggregateRoot<TKey> extends BasicAggregateRoot<TKey> {
extraProperties: Record<string, object>;
concurrencyStamp?: string;
}
export interface BasicAggregateRoot<TKey> extends Entity<TKey> {
}
export interface Entity {
}
Error message:
Error: src/app/proxy/volo/abp/domain/entities/models.ts:7:51 - error TS2315: Type 'Entity' is not generic.
7 export interface BasicAggregateRoot<TKey> extends Entity<TKey> {
~~~~~~~~~~~~
Command run to generate proxy:
abp generate-proxy -t ng -m core -u https://localhost:44311
Is there a suggested way to handle ActionResult custom endpoints e.g. suppose I have a custom controller with a custom endpoint:
namespace Core.Models.Transmittal
{
[RemoteService(Name = "Core")]
[Area("core")]
[ControllerName("Transmittal")]
[Route("api/core/transmittals")]
public class TransmittalController : TransmittalControllerBase, ITransmittalsAppService
{
[HttpGet]
[Route("my-custom-endpoint")]
public async Task<ActionResult<PagedResultDto<string>>> GetMyCustomEndpoint() { ... }
Upon running abp generate-proxy -t ng -m core -u https://localhost:44311
the output is a separate and invalid .ts file:
mvc\models.ts (note: this is invalid Typescript output; the below file does not compile)
export interface ActionResult {
}
export interface ActionResult<TValue> {
result: ActionResult;
value: TValue;
}
export interface IActionResult {
}
And in the generated proxy output transmittal.service.ts:
this.restService.request<any, ActionResult<PagedResultDto<string>>>({
method: 'GET',
url: '/api/core/transmittals/my-custom-endpoint',
params: { },
},
{ apiName: this.apiName,...config });
The endpoint only uses ActionResult to change the status response e.g. Ok() or NoContent() or some custom status code response but the actual output should just be the PagedResultDto<string>
Is there something I'm missing here? ActionResult<T> responses are a special exception so I'm not entirely sure why the mvc\models.ts output is showing the generated output of ActionResult<TValue> with a result self-referencing itself (this is invalid Typescript generation too so the output does not compile).