Skip to content

Commit

Permalink
fix re parition key when there is no property for it
Browse files Browse the repository at this point in the history
  • Loading branch information
lenchvolodymyr committed Jan 21, 2021
1 parent 2bd8546 commit 39796c9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion forward_engineering/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ const updateSample = (sample, containerData, entityData) => {
};

const getPartitionKey = (_) => (containerData) => {
return _.get(containerData, '[0].partitionKey[0].name');
const partitionKey = _.get(containerData, '[0].partitionKey[0].name', '').trim().replace(/\/$/, '');

return partitionKey;
};

const add = (key, items, mapper) => (script) => {
Expand Down
2 changes: 1 addition & 1 deletion reverse_engineering/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ module.exports = {
indexes: [],
views: [],
validation: createSchemaByPartitionKeyPath(partitionKey, filteredDocuments),
docType: bucketName,
docType: 'type',
bucketInfo
};

Expand Down

0 comments on commit 39796c9

Please sign in to comment.