Open mrkvon opened 1 year ago
Thanks for pointing this out.
Just want to chime in that I'm having the same problem (I think so, at least), with the given ShEx input:
shape:Chapter EXTRA rdf:type {
rdf:type [ selaw:Chapter ] ;
dct:title xsd:string ;
selaw:referenceNumber xsd:string ;
( dct:hasPart @shape:Section* | dct:hasPart @shape:Paragraph* ) ;
}
shape:Section EXTRA rdf:type {
rdf:type [ selaw:Section ] ;
dct:title xsd:string ;
dct:hasPart @shape:Paragraph* ;
}
shape:Paragraph EXTRA rdf:type {
rdf:type [ selaw:Paragraph ] ;
rdf:value xsd:string ;
selaw:referenceNumber xsd:string ;
dct:hasPart @shape:ListItem* ;
}
The interesting part here is ( dct:hasPart @shape:Section* | dct:hasPart @shape:Paragraph* ) ;
under the shape shape:Chapter
.
The output for Chapter:
export interface Chapter {
"@id"?: string;
"@context"?: ContextDefinition;
type: {
"@id": "Chapter";
};
title: string;
referenceNumber: string;
}
Here I would expect to see something like hasPart: Section[] | Paragraph[]
.
Just want to mention that the following work-around works (in case others have similar problem):
shape:Chapter EXTRA rdf:type {
rdf:type [ selaw:Chapter ] ;
dct:title xsd:string ;
selaw:referenceNumber xsd:string ;
dct:hasPart @shape:Section* ;
dct:hasPart @shape:Paragraph* ;
}
Which outputs:
export interface Chapter {
"@id"?: string;
"@context"?: ContextDefinition;
type: {
"@id": "Chapter";
};
title: string;
referenceNumber: string;
hasPart?: (Section | Paragraph)[];
}
Is this the intended way in general?
edit: this issue is rather related to
ldo-cli
, and repository owners could move it there, sorry for the messWhen i run
yarn run build:ldo
with shex that containsOR
keyword, i get the following error:For example, the following shape (WAC Authorization) fails:
I'd expect the build to pass and produce union type (e.g.
Agent | AgentClass
)Initial debugging
It seems that dts-dom doesn't receive a correct configuration to produce the typings. Somewhere along the way,
doesn't get transformed into
{ kind: 'union', members: [...], ... }