Skip to content

Commit

Permalink
Reverts throwing error as that won't work.
Browse files Browse the repository at this point in the history
  • Loading branch information
mkornatz committed Aug 18, 2020
1 parent cf4578f commit b4c313b
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 18 deletions.
1 change: 1 addition & 0 deletions src/driver/sqlite-abstract/AbstractSqliteDriver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,7 @@ export abstract class AbstractSqliteDriver implements Driver {
value = DateUtils.stringToSimpleArray(value);

} else if (columnMetadata.type === "simple-json") {
console.log(value, typeof value);
value = DateUtils.stringToSimpleJson(value);

} else if ( columnMetadata.type === "simple-enum" ) {
Expand Down
12 changes: 0 additions & 12 deletions src/error/SimpleJsonIsNotAStringError.ts

This file was deleted.

6 changes: 1 addition & 5 deletions src/util/DateUtils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { ColumnMetadata } from "../metadata/ColumnMetadata";
import { SimpleJsonIsNotAStringError } from "../error/SimpleJsonIsNotAStringError";

/**
* Provides utilities to transform hydrated and persisted data.
Expand Down Expand Up @@ -176,10 +175,7 @@ export class DateUtils {
}

static stringToSimpleJson(value: any) {
if (value && typeof value !== "string") {
throw new SimpleJsonIsNotAStringError(value);
}
return value !== "" ? JSON.parse(value) : value;
return value === "string" ? JSON.parse(value) : value;
}

static simpleEnumToString(value: any) {
Expand Down
1 change: 0 additions & 1 deletion test/github-issues/5501/entity/Post.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,4 @@ export class Post {
nullable: true
})
jsonField: any;

}

0 comments on commit b4c313b

Please sign in to comment.