Skip to content
This repository was archived by the owner on Jan 8, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/visitors/typescript/generates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,8 @@ export function generateTsType(valueExpr: any, toCreate?: boolean) {
return toCreate ? 'Date | Literal' : 'Date';
} else if (valueExpr?.datatype === ns.xsd('string')) {
return toCreate ? 'string | Literal' : 'string';
} else if (valueExpr?.datatype === ns.xsd('language')) {
return toCreate ? 'string | Literal' : 'string';
} else if (valueExpr?.datatype) {
return valueExpr?.datatype;
} else if (typeof valueExpr === 'string') {
Expand Down
5 changes: 5 additions & 0 deletions test/__snapshots__/generate.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -701,6 +701,7 @@ export const cryptocurrency = new Shape<

export type BasicContainerShape = {
id: string; // the url of a node of this shape
description: string; // Gives a description for the resource
contains?: ResourceShape | ResourceShape[]; // Contains these Resources
size: number; // Size of Container
mtime: number; // Time of Container creation created
Expand All @@ -714,6 +715,7 @@ export type BasicContainerShape = {

export type BasicContainerShapeCreateArgs = {
id?: string | NamedNode; // the url to match or create the node with e.g. 'https://example.com#this', 'https://example.com/profile/card#me'
description: string | Literal; // Gives a description for the resource
contains?:
| URL
| NamedNode
Expand Down Expand Up @@ -762,6 +764,7 @@ export enum ResourceShapeType {

export enum BasicContainerShapeContext {
type = 'rdf:type',
description = 'terms:description',
contains = 'ldp:contains',
size = 'st:size',
mtime = 'st:mtime',
Expand All @@ -788,6 +791,8 @@ ldp:BasicContainerShape EXTRA a {
// rdfs:comment \\"Defines the node as a Container\\" ;
a [ ldp:Container ]
// rdfs:comment \\"Defines the node as a Container\\" ;
terms:description xsd:language
// rdfs:comment \\"Gives a description for the resource\\" ;
ldp:contains @ldp:ResourceShape *
// rdfs:comment \\"Contains these Resources\\" ;
st:size xsd:integer
Expand Down
2 changes: 2 additions & 0 deletions test/shapes/ldpShapes.shex
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ ldp:BasicContainerShape EXTRA a {
// rdfs:comment "Defines the node as a Container" ;
a [ ldp:Container ]
// rdfs:comment "Defines the node as a Container" ;
terms:description xsd:language
// rdfs:comment "Gives a description for the resource" ;
ldp:contains @ldp:ResourceShape *
// rdfs:comment "Contains these Resources" ;
st:size xsd:integer
Expand Down