diff --git a/src/types/base.type.ts b/src/types/base.type.ts index 746b7fb..6e9ad2d 100644 --- a/src/types/base.type.ts +++ b/src/types/base.type.ts @@ -150,7 +150,8 @@ export abstract class BaseType { ): morph.PropertySignatureStructure { let fieldName = name; if (fieldName.includes("/")) fieldName = `"${fieldName}"`; - if (element.canBeNull || element.type === Type.Association) fieldName = `${fieldName}?`; + if (element.canBeNull || element.type === Type.Association) + fieldName = `${fieldName}?`; let fieldType = "unknown"; if (element.enum) { @@ -161,7 +162,6 @@ export abstract class BaseType { fieldType = this.cdsElementToType(element, types, prefix); } - return { kind: morph.StructureKind.PropertySignature, name: fieldName, @@ -390,6 +390,10 @@ export abstract class BaseType { case Type.LargeBinary: result = "Buffer"; break; + + case Type.HanaTinyint: + result = "number"; + break; } return result; diff --git a/src/utils/cds.types.ts b/src/utils/cds.types.ts index 7dd9adb..0cdaf67 100644 --- a/src/utils/cds.types.ts +++ b/src/utils/cds.types.ts @@ -24,6 +24,7 @@ export enum Type { LargeString = "cds.LargeString", LargeBinary = "cds.LargeBinary", User = "User", + HanaTinyint = "cds.hana.TINYINT", } export enum Kind { diff --git a/test/srv/service.cds b/test/srv/service.cds index f09e0f5..8c7457d 100644 --- a/test/srv/service.cds +++ b/test/srv/service.cds @@ -13,8 +13,9 @@ service CatalogService @(path : '/browse') { @readonly entity Books as select from my.Books { - * , - author.name as author + *, + author.name as author, + virtual 1 as isStockVisible : hana.TINYINT } excluding { createdBy, @@ -22,15 +23,15 @@ service CatalogService @(path : '/browse') { } actions { - action addRating(stars : Integer); + action addRating(stars : Integer); function getViewsCount() returns Integer; } - function getBooks(author : my.Authors:ID) returns array of Books; - action unboudAction(simpleParameter : String, arrayParameter : array of arrayParameterType, typedParameter : typedParameterType) returns ActionReturnType; + function getBooks(author : my.Authors:ID) returns array of Books; + action unboudAction(simpleParameter : String, arrayParameter : array of arrayParameterType, typedParameter : typedParameterType) returns ActionReturnType; @requires_ : 'authenticated-user' - action submitOrder(book : Books:ID, amount : Integer); + action submitOrder(book : Books:ID, amount : Integer); type arrayParameterType : {