Does Vendor actually support simple-json? #2949
-
Hi. On https://docs.vendure.io/guides/developer-guide/custom-fields/#list , it says, “For lists of primitive types (anything except relation), the database type will be set to simple-json which serializes the data into a JSON string.” And according to https://orkhan.gitbook.io/typeorm/docs/entities#simple-json-column-type , I should be able to create a simple-json column directly in my custom entity. I’ve tried many things. In a custom entity,
And in vendure-config.ts,
Of these, all have their type set as “text” except for one_name: number[] which is set as I expected. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi, The "simple-json" type only exists internally in TypeORM - as far as the database is concerned, it's just a string of text. TypeORM is responsible for serializing & deserializing the data into the expected object. In terms of custom fields (like your This line:
just means that internally, if you set a custom field to e.g. |
Beta Was this translation helpful? Give feedback.
Hi,
The "simple-json" type only exists internally in TypeORM - as far as the database is concerned, it's just a string of text. TypeORM is responsible for serializing & deserializing the data into the expected object.
In terms of custom fields (like your
infoUrls
example), thetype: 'simple-json'
is not valid in Vendure. The permitted custom field types are listed here: https://docs.vendure.io/guides/developer-guide/custom-fields/#available-custom-field-typesThis line:
just means that internally, if you set a custom field to e.g.
{ type: 'st…