Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
21 changes: 21 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"dependencies": {
"@apidevtools/json-schema-ref-parser": "^11.1.0",
"@apidevtools/swagger-parser": "^10.1.0",
"@asyncapi/modelina": "^5.10.1",
"@asyncapi/multi-parser": "^2.2.0",
"@asyncapi/parser": "^3.4.0",
"alterschema": "^1.1.2",
Expand Down
4 changes: 4 additions & 0 deletions src/generators/typescript/TypeScriptConstrainer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ export const TypeScriptDefaultTypeMapping: TypeScriptTypeMapping = {
return applyNullable(constrainedModel, 'number');
},
String({ constrainedModel }): string {
const format = constrainedModel?.options?.format;
if(format ==="date-time" || format ==="date"|| format ==='time'){
return applyNullable(constrainedModel, 'Date');
}
return applyNullable(constrainedModel, 'string');
},
Boolean({ constrainedModel }): string {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,15 @@ Array [
private _specversion: string;
private _reservedType: CloudEventType.DOG = CloudEventType.DOG;
private _dataschema?: string;
private _time?: string;
private _time?: Date;
private _additionalProperties?: Map<string, any>;

constructor(input: {
id: string,
source: string,
specversion: string,
dataschema?: string,
time?: string,
time?: Date,
additionalProperties?: Map<string, any>,
}) {
this._id = input.id;
Expand All @@ -130,8 +130,8 @@ Array [
get dataschema(): string | undefined { return this._dataschema; }
set dataschema(dataschema: string | undefined) { this._dataschema = dataschema; }

get time(): string | undefined { return this._time; }
set time(time: string | undefined) { this._time = time; }
get time(): Date | undefined { return this._time; }
set time(time: Date | undefined) { this._time = time; }

get additionalProperties(): Map<string, any> | undefined { return this._additionalProperties; }
set additionalProperties(additionalProperties: Map<string, any> | undefined) { this._additionalProperties = additionalProperties; }
Expand All @@ -146,15 +146,15 @@ Array [
private _specversion: string;
private _reservedType: CloudEventType.CAT = CloudEventType.CAT;
private _dataschema?: string;
private _time?: string;
private _time?: Date;
private _additionalProperties?: Map<string, any>;

constructor(input: {
id: string,
source: string,
specversion: string,
dataschema?: string,
time?: string,
time?: Date,
additionalProperties?: Map<string, any>,
}) {
this._id = input.id;
Expand All @@ -179,8 +179,8 @@ Array [
get dataschema(): string | undefined { return this._dataschema; }
set dataschema(dataschema: string | undefined) { this._dataschema = dataschema; }

get time(): string | undefined { return this._time; }
set time(time: string | undefined) { this._time = time; }
get time(): Date | undefined { return this._time; }
set time(time: Date | undefined) { this._time = time; }

get additionalProperties(): Map<string, any> | undefined { return this._additionalProperties; }
set additionalProperties(additionalProperties: Map<string, any> | undefined) { this._additionalProperties = additionalProperties; }
Expand Down Expand Up @@ -377,13 +377,13 @@ Array [
"class ReservedEvent {
private _id: string;
private _action?: Action;
private _eventTime?: string;
private _eventTime?: Date;
private _additionalProperties?: Map<string, any>;

constructor(input: {
id: string,
action?: Action,
eventTime?: string,
eventTime?: Date,
additionalProperties?: Map<string, any>,
}) {
this._id = input.id;
Expand All @@ -398,8 +398,8 @@ Array [
get action(): Action | undefined { return this._action; }
set action(action: Action | undefined) { this._action = action; }

get eventTime(): string | undefined { return this._eventTime; }
set eventTime(eventTime: string | undefined) { this._eventTime = eventTime; }
get eventTime(): Date | undefined { return this._eventTime; }
set eventTime(eventTime: Date | undefined) { this._eventTime = eventTime; }

get additionalProperties(): Map<string, any> | undefined { return this._additionalProperties; }
set additionalProperties(additionalProperties: Map<string, any> | undefined) { this._additionalProperties = additionalProperties; }
Expand Down