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

fix(validation): add validation schema for rich text nodes #152

Merged
merged 1 commit into from
Nov 28, 2018

Conversation

phoebeschmidt
Copy link
Contributor

No description provided.

@codecov
Copy link

codecov bot commented Nov 27, 2018

Codecov Report

Merging #152 into master will decrease coverage by 9.07%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #152      +/-   ##
==========================================
- Coverage   88.44%   79.37%   -9.08%     
==========================================
  Files          80       80              
  Lines        2060     2148      +88     
  Branches      229      242      +13     
==========================================
- Hits         1822     1705     -117     
- Misses        194      361     +167     
- Partials       44       82      +38
Impacted Files Coverage Δ
...e-api/validator/schema/field-validations-schema.ts 100% <100%> (ø) ⬆️
src/bin/lib/steps-errors.ts 20.58% <0%> (-76.48%) ⬇️
src/lib/intent/entry-derive.ts 42.85% <0%> (-57.15%) ⬇️
src/lib/offline-api/validator/errors.ts 35.48% <0%> (-56.83%) ⬇️
.../lib/offline-api/validator/schema/fields-schema.ts 58.33% <0%> (-41.67%) ⬇️
src/lib/intent-validator/field-movement.ts 63.15% <0%> (-36.85%) ⬇️
src/lib/migration-chunks/validation/field.ts 61.8% <0%> (-36.65%) ⬇️
src/lib/intent/field-move.ts 65.51% <0%> (-34.49%) ⬇️
src/lib/intent/editorinterface-reset.ts 40% <0%> (-24.29%) ⬇️
src/bin/cli.ts 53.06% <0%> (-22.45%) ⬇️
... and 22 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 99b4976...32a725a. Read the comment docs.

@@ -31,6 +31,32 @@ const assetImageDimensions = validation('assetImageDimensions', Joi.object({

const assetFileSize = validation('assetFileSize', range('number'))

const nodes = validation('nodes', Joi.object({
'embedded-entry-block': Joi.array(),
Copy link
Contributor Author

@phoebeschmidt phoebeschmidt Nov 27, 2018

Choose a reason for hiding this comment

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

here decided to be very general, although AFAIK these are the possible validations in this case:
(object with size and message, object with linkContentType and message

{"nodes": {
	"embedded-entry-inline": [
              {
                "size": {
                  "min": 10,
                  "max": 20
                },
                "message": "this is a custom error for number of embedded inline entries"
              },
              {
                "linkContentType": [
                  "parent"
                ],
                "message": "we only accept parent"
              }
    ]
}

do you think I should go one level deeper with possible validations here?

@phoebeschmidt phoebeschmidt force-pushed the fix/rich-text-validation branch from a22f4c2 to 32a725a Compare November 28, 2018 14:56
@phoebeschmidt phoebeschmidt merged commit 3b9efdf into master Nov 28, 2018
@phoebeschmidt phoebeschmidt deleted the fix/rich-text-validation branch November 28, 2018 16:01
@phoebeschmidt
Copy link
Contributor Author

🎉 This PR is included in version 0.15.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants