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

Add simplest validation to check data documents #1246

Merged
merged 27 commits into from Oct 17, 2022

Conversation

rumyantseva
Copy link
Member

@rumyantseva rumyantseva commented Oct 12, 2022

Description

This PR closes #693.

In this solution we introduce (d *Document) ValidateData() error method to validate documents representing data.
We use this method to solve what's needed in #693.

Tests are present in FerretDB/dance#211.

Tigris will be covered in the same Sprint in a separate task #1248 (to make tigrisdb similar to pgdb).

Readiness checklist

  • I added tests for new functionality or bugfixes.
  • I ran task all, and it passed.
  • I added/updated comments for both exported and unexported top-level declarations (functions, types, etc).
  • I checked comments rendering with task godocs.
  • I ensured that the title is good enough for the changelog.
  • (for maintainers only) I set Reviewers (@FerretDB/core), Assignee, Labels, Project and project's Sprint fields.
  • I marked all done items in this checklist.

@rumyantseva rumyantseva self-assigned this Oct 12, 2022
@vercel
Copy link

vercel bot commented Oct 12, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
ferret-db ✅ Ready (Inspect) Visit Preview Oct 17, 2022 at 5:29AM (UTC)

@rumyantseva rumyantseva added validation code/enhancement Some user-visible feature could work better and removed validation labels Oct 12, 2022
@vercel vercel bot temporarily deployed to Preview October 12, 2022 08:39 Inactive
@vercel vercel bot temporarily deployed to Preview October 12, 2022 08:41 Inactive
@codecov
Copy link

codecov bot commented Oct 12, 2022

Codecov Report

Merging #1246 (e67286e) into main (c363ece) will decrease coverage by 0.27%.
The diff coverage is 52.77%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1246      +/-   ##
==========================================
- Coverage   66.64%   66.37%   -0.28%     
==========================================
  Files         269      270       +1     
  Lines       12574    12609      +35     
==========================================
- Hits         8380     8369      -11     
- Misses       3296     3331      +35     
- Partials      898      909      +11     
Impacted Files Coverage Δ
internal/handlers/pg/msg_insert.go 40.00% <0.00%> (-2.26%) ⬇️
internal/handlers/pg/pgdb/insert.go 30.76% <0.00%> (-4.02%) ⬇️
internal/handlers/pg/pgdb/update.go 60.86% <0.00%> (-9.14%) ⬇️
internal/handlers/pg/msg_update.go 57.60% <50.00%> (-0.68%) ⬇️
internal/types/document_validation.go 87.50% <87.50%> (ø)
internal/util/version/version.go 48.52% <0.00%> (-4.42%) ⬇️
internal/handlers/pg/pgdb/query.go 51.41% <0.00%> (-2.83%) ⬇️
internal/handlers/common/filter.go 86.58% <0.00%> (-2.21%) ⬇️
Flag Coverage Δ
integration 62.57% <30.55%> (-0.29%) ⬇️
mongodb 14.12% <0.00%> (-0.08%) ⬇️
pg 52.10% <30.55%> (-0.26%) ⬇️
tigris 33.75% <0.00%> (-0.12%) ⬇️
unit 24.83% <38.88%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

@vercel vercel bot temporarily deployed to Preview October 12, 2022 08:49 Inactive
@vercel vercel bot temporarily deployed to Preview October 12, 2022 11:55 Inactive
@vercel vercel bot temporarily deployed to Preview October 12, 2022 15:00 Inactive
@vercel vercel bot temporarily deployed to Preview October 12, 2022 15:06 Inactive
@vercel vercel bot temporarily deployed to Preview October 12, 2022 15:20 Inactive
@rumyantseva rumyantseva marked this pull request as ready for review October 12, 2022 15:21
@rumyantseva rumyantseva requested a review from a team as a code owner October 12, 2022 15:21
@vercel vercel bot temporarily deployed to Preview October 12, 2022 15:21 Inactive
@vercel vercel bot temporarily deployed to Preview October 12, 2022 23:23 Inactive
internal/handlers/pg/msg_update.go Outdated Show resolved Hide resolved
internal/types/document_validation.go Outdated Show resolved Hide resolved
internal/types/document_validation_test.go Outdated Show resolved Hide resolved
website/docs/diff.md Outdated Show resolved Hide resolved
Copy link
Contributor

@w84thesun w84thesun left a comment

Choose a reason for hiding this comment

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

Overall good, except for those comments @AlekSi already provided.

@vercel vercel bot temporarily deployed to Preview October 13, 2022 13:00 Inactive
Co-authored-by: Alexey Palazhchenko <alexey.palazhchenko@gmail.com>
@vercel vercel bot temporarily deployed to Preview October 13, 2022 14:21 Inactive
@vercel vercel bot temporarily deployed to Preview October 13, 2022 14:24 Inactive
@vercel
Copy link

vercel bot commented Oct 13, 2022

Deployment failed with the following error:

Creating the Deployment Timed Out.

@vercel vercel bot temporarily deployed to Preview October 13, 2022 15:19 Inactive
@vercel vercel bot temporarily deployed to Preview October 14, 2022 10:46 Inactive
@vercel vercel bot temporarily deployed to Preview October 14, 2022 11:47 Inactive
@vercel vercel bot temporarily deployed to Preview October 14, 2022 11:54 Inactive
Copy link
Contributor

@chilagrow chilagrow left a comment

Choose a reason for hiding this comment

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

Looks good to me 🚀

@vercel vercel bot temporarily deployed to Preview October 17, 2022 05:29 Inactive
@rumyantseva rumyantseva merged commit 68d11f7 into FerretDB:main Oct 17, 2022
@rumyantseva rumyantseva deleted the issue-693-new-validation branch October 17, 2022 05:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code/enhancement Some user-visible feature could work better
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Explicitly disallow field names with $
6 participants