table icon indicating copy to clipboard operation
table copied to clipboard

chaning of the options schema broke semver compatibility

Open attilah opened this issue 2 years ago • 1 comments

A change since 6.0.4 when the useWordWrap option has changed causing runtime errors with schema validation for upstream packages and how the change was implemented is a breaking change.

table package is used by aws-cdk with caret versioning and in @aws-amplify/cli. CDK 1.72.0 references ^6.0.3 of table, but the latest 6.7.1 fulfils the semver requirement so that is getting installed with the Amplify CLI.

When the component is invoked then this error message pops up:

config {
  border: {
    topBody: '\x1B[90m─\x1B[39m',
    topJoin: '\x1B[90m┬\x1B[39m',
    topLeft: '\x1B[90m┌\x1B[39m',
    topRight: '\x1B[90m┐\x1B[39m',
    bottomBody: '\x1B[90m─\x1B[39m',
    bottomJoin: '\x1B[90m┴\x1B[39m',
    bottomLeft: '\x1B[90m└\x1B[39m',
    bottomRight: '\x1B[90m┘\x1B[39m',
    bodyLeft: '\x1B[90m│\x1B[39m',
    bodyRight: '\x1B[90m│\x1B[39m',
    bodyJoin: '\x1B[90m│\x1B[39m',
    joinBody: '\x1B[90m─\x1B[39m',
    joinLeft: '\x1B[90m├\x1B[39m',
    joinRight: '\x1B[90m┤\x1B[39m',
    joinJoin: '\x1B[90m┼\x1B[39m'
  },
  columns: {
    '0': { width: 1, useWordWrap: true },
    '1': { width: 41, useWordWrap: true },
    '2': { width: 6, useWordWrap: true },
    '3': { width: 41, useWordWrap: true },
    '4': { width: 42, useWordWrap: true },
    '5': { width: 9, useWordWrap: true }
  },
  drawHorizontalLine: [Function: drawHorizontalLine]
}
errors [
  {
    message: 'must NOT have additional properties',
    params: { additionalProperty: 'useWordWrap' },
    schemaPath: '#/additionalProperties'
  },
  {
    message: 'must NOT have additional properties',
    params: { additionalProperty: 'useWordWrap' },
    schemaPath: '#/additionalProperties'
  },
  {
    message: 'must NOT have additional properties',
    params: { additionalProperty: 'useWordWrap' },
    schemaPath: '#/additionalProperties'
  },
  {
    message: 'must NOT have additional properties',
    params: { additionalProperty: 'useWordWrap' },
    schemaPath: '#/additionalProperties'
  },
  {
    message: 'must NOT have additional properties',
    params: { additionalProperty: 'useWordWrap' },
    schemaPath: '#/additionalProperties'
  },
  {
    message: 'must NOT have additional properties',
    params: { additionalProperty: 'useWordWrap' },
    schemaPath: '#/additionalProperties'
  },
  {
    message: 'must be array',
    params: { type: 'array' },
    schemaPath: '#/oneOf/1/type'
  },
  {
    message: 'must match exactly one schema in oneOf',
    params: { passingSchemas: null },
    schemaPath: '#/oneOf'
  }
]
2021-08-20T16:30:24.882Z - error: uncaughtException: Invalid config. date=Fri Aug 20 2021 09:30:24 GMT-0700 (Pacific Daylight Time), pid=35690, uid=501, gid=20, cwd=/Users/attila/workspaces/amplify-projects/auther, execPath=/Users/attila/.nvm/versions/node/v14.15.0/bin/node, version=v14.15.0, argv=[/Users/attila/.nvm/versions/node/v14.15.0/bin/node, /Users/attila/.nvm/versions/node/v14.15.0/bin/amplify, status, -v], rss=418119680, heapTotal=324071424, heapUsed=297239232, external=5893944, arrayBuffers=3754860, loadavg=[2.1064453125, 2.60546875, 3.00634765625], uptime=132107, trace=[column=15, file=/Users/attila/.nvm/versions/node/v14.15.0/lib/node_modules/@aws-amplify/cli/node_modules/table/dist/validateConfig.js, function=Object.validateConfig, line=22, method=validateConfig, native=false, column=22, file=/Users/attila/.nvm/versions/node/v14.15.0/lib/node_modules/@aws-amplify/cli/node_modules/table/dist/makeTableConfig.js, function=Object.makeTableConfig, line=50, method=makeTableConfig, native=false, column=38, file=/Users/attila/.nvm/versions/node/v14.15.0/lib/node_modules/@aws-amplify/cli/node_modules/table/dist/table.js, function=Object.table, line=17, method=table, native=false, column=16, file=/Users/attila/.nvm/versions/node/v14.15.0/lib/node_modules/@aws-amplify/cli/node_modules/@aws-cdk/cloudformation-diff/lib/format-table.ts, function=Object.formatTable, line=11, method=formatTable, native=false, column=18, file=/Users/attila/.nvm/versions/node/v14.15.0/lib/node_modules/@aws-amplify/cli/node_modules/@aws-cdk/cloudformation-diff/lib/format.ts, function=Formatter.formatIamChanges, line=369, method=formatIamChanges, native=false, column=13, file=/Users/attila/.nvm/versions/node/v14.15.0/lib/node_modules/@aws-amplify/cli/node_modules/@aws-cdk/cloudformation-diff/lib/format.ts, function=formatSecurityChangesWithBanner, line=71, method=null, native=false, column=3, file=/Users/attila/.nvm/versions/node/v14.15.0/lib/node_modules/@aws-amplify/cli/node_modules/@aws-cdk/cloudformation-diff/lib/format.ts, function=Object.formatDifferences, line=45, method=formatDifferences, native=false, column=19, file=/Users/attila/.nvm/versions/node/v14.15.0/lib/node_modules/@aws-amplify/cli/src/extensions/amplify-helpers/resource-status-diff.ts, function=ResourceDiff.printStackDiff, line=208, method=printStackDiff, native=false, column=30, file=/Users/attila/.nvm/versions/node/v14.15.0/lib/node_modules/@aws-amplify/cli/src/extensions/amplify-helpers/resource-status-diff.ts, function=ResourceDiff.printResourceDetailStatus, line=141, method=printResourceDetailStatus, native=false], stack=[Error: Invalid config.,     at Object.validateConfig (/Users/attila/.nvm/versions/node/v14.15.0/lib/node_modules/@aws-amplify/cli/node_modules/table/dist/validateConfig.js:22:15),     at Object.makeTableConfig (/Users/attila/.nvm/versions/node/v14.15.0/lib/node_modules/@aws-amplify/cli/node_modules/table/dist/makeTableConfig.js:50:22),     at Object.table (/Users/attila/.nvm/versions/node/v14.15.0/lib/node_modules/@aws-amplify/cli/node_modules/table/dist/table.js:17:38)

Since 1.72.0 CDK removed the usage of the useWordWrap property but it requires everyone to update their packages if using table. From the library side to make it a non-breaking change it would be nice to support oneOf useWordWrap or the new wordWrap option.

What do you think? could it make it into a 6.7.2 release?

attilah avatar Aug 20 '21 16:08 attilah

Sorry for the inconvenience. But honestly, I can't find any config schema used useWordWrap, the word wrapping feature uses wrapWord from the beginning (https://github.com/gajus/table/commit/c41fdb2e6736389073ccf919bf84fca69d1ceb5c). Please help me to double-check again, so we can suggest a suitable solution. Thanks.

nam-hle avatar Aug 31 '21 07:08 nam-hle