frontend
frontend copied to clipboard
Front generator: wrong ts type created for Transient List
I have two entities named SubwayLine
and Station
, which is a one-to-many relationship. To avoid hard link in DB, I created a @Transient property stations
in SubwayLine.java
:
@NamePattern("%s|name")
@Table(name = "SUBWAYBASE_SUBWAY_LINE")
@Entity(name = "subwaybase_SubwayLine")
public class SubwayLine extends BaseUuidEntity implements Creatable, Updatable {
private static final long serialVersionUID = 4653380561262598600L;
// ... other fields.
@Transient
@MetaProperty
protected List<Station> stations;
Using gen-cuba-front sdk:all
to generate entities and APIs, generated ts class:
import { BaseUuidEntity } from "./sys$BaseUuidEntity";
import { Station } from "./subwaybase_Station";
export class SubwayLine extends BaseUuidEntity {
static NAME = "subwaybase_SubwayLine";
// ... other fields.
stations?: Station | null;
}
Related field in projectModel.json
:
{"name":"stations","type":{"packageName":"com.abmcode.subwaybase.entity","className":"Station","fqn":"com.abmcode.subwaybase.entity.Station","label":"Station","entityName":"subwaybase_Station"},"mappingType":"ASSOCIATION","readOnly":false,"mandatory":false,"unique":false,"transient":true}
The correct behavior, it should generate stations
field in ts as Station[]|null
type.
I'm using:
CUBA Platform version: 7.2.4
CUBA Studio plugin version: 13.4-191
IntelliJ version: IntelliJ IDEA 2020.1.2 (Ultimate Edition)
gen-cuba-front --version
3.0.1
We don't support transient properties with cardinality 'many' at this time. Will be implemented in next milestone.
Hi @vadimbasko , Sure, it's not showstopper as the workaround is very straightforward - I can modify the ts file manually.