Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Contentful/validation improvements #985

Merged
merged 7 commits into from
Oct 19, 2020
Merged

Conversation

dpinol
Copy link
Contributor

@dpinol dpinol commented Oct 8, 2020

Please review commit by commit

  • logger injection in ErrorReportingCMS: Not we allow customizing the sink of the error messages.Improvements in prints of recursive exception stacks

  • Improvements in Content.validate of text & shortText fields

    • Validate text.text also if content has no keywords (it could be accessed through a button)
    • Before, when shortText was empty, the contentful driver set it with the value of the name field (to ensure buttons did not show blank texts). Now this is managed by the Button model, so that MessageContent.validate() can report it
  • Check that contentful button targets are available

  • Added asserts to asserts in ContentsValidator unit test

To document

breaking change: We remove the Context.fixMissingData flag. It was confusing because:
* we already set shortText with the name field when it's missing
* we have the resumeErrors option for contentful

@dpinol dpinol added the documentation Documentation changes label Oct 8, 2020
Comment on lines +90 to +94
- id: inbenta
name: inbenta
entry: scripts/qa/lint-package.sh packages/botonic-plugin-inbenta
language: system
files: ^packages/botonic-plugin-inbenta/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! 👏

import { testContentful } from '../contentful.helper'
import { ENGLISH } from '../../../src/nlp'

test('TEST: contentful button', async () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does it test here exactly?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@asastre
well, seen! I added asserts

it was never used by any bot
allows customizing the sink of the error messages.
Improvement in prints of recursive exception stacks
Validate text.text also if !searchable
Before, when shortText was empty, the contentful driver set it with the
value of the name field. Now this is managed by the Button model, so that
validate can report it
it might be confusing because:
* we already set shortText with name when missing
* we have the resumeError flag
check button target is available and type of delivered content
add test for contentful element delivery
@dpinol dpinol force-pushed the contentful/validation-improvements branch from 80fa4f8 to 692262a Compare October 18, 2020 05:29
@dpinol dpinol mentioned this pull request Oct 18, 2020
}
} else if (this.logStack && contentfulError.stack) {
err += contentfulError.stack.split('\n').slice(0, 5).join('\n')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe a bit "hacky" Why are you slicing here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't want to spam the logs with too long callstack

@dpinol dpinol merged commit 4765bc6 into master Oct 19, 2020
@dpinol dpinol deleted the contentful/validation-improvements branch October 19, 2020 09:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Documentation changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants