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

tjson: Fix schema comparison #944

Merged
merged 23 commits into from
Jul 27, 2022

Conversation

rumyantseva
Copy link
Member

@rumyantseva rumyantseva commented Jul 26, 2022

Description

This PR closes #907.

This implementation offers recursive calls of schema.Equal instead of reflect.DeepEqual.

Schemas are considered equal if:

  • for arrays: Items' schemas are equal
  • for objects: the keys are the same, and their schemas are equal
  • for scalars: their types and formats are equal

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.
  • (for maintainers only) I set Reviewers, Assignee, Labels, Project and project's Sprint fields.
  • I marked all done items in this checklist.

@codecov
Copy link

codecov bot commented Jul 26, 2022

Codecov Report

Merging #944 (7c6c160) into main (024cf92) will increase coverage by 0.11%.
The diff coverage is 77.08%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #944      +/-   ##
==========================================
+ Coverage   61.94%   62.05%   +0.11%     
==========================================
  Files         228      228              
  Lines       10610    10657      +47     
==========================================
+ Hits         6572     6613      +41     
- Misses       3259     3262       +3     
- Partials      779      782       +3     
Impacted Files Coverage Δ
internal/tjson/schema.go 63.41% <77.08%> (+14.73%) ⬆️
internal/util/version/version.go 55.00% <0.00%> (-5.00%) ⬇️
internal/handlers/pg/pgdb/collections.go 60.17% <0.00%> (+2.65%) ⬆️
Flag Coverage Δ
integration 56.39% <0.00%> (-0.28%) ⬇️
mongodb 18.59% <ø> (-0.06%) ⬇️
pg 61.57% <ø> (-0.04%) ⬇️
tigris 18.06% <0.00%> (-0.11%) ⬇️
unit 25.01% <77.08%> (+0.28%) ⬆️

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

@rumyantseva rumyantseva self-assigned this Jul 26, 2022
@rumyantseva rumyantseva added the code/chore Code maintenance improvements label Jul 26, 2022
@rumyantseva rumyantseva marked this pull request as ready for review July 26, 2022 14:02
@rumyantseva rumyantseva requested a review from a team as a code owner July 26, 2022 14:02
@rumyantseva rumyantseva requested review from AlekSi, a team, w84thesun and noisersup and removed request for a team July 26, 2022 14:02
internal/tjson/schema.go Outdated Show resolved Hide resolved
internal/tjson/schema_test.go Outdated Show resolved Hide resolved
internal/tjson/schema_test.go Outdated Show resolved Hide resolved
internal/tjson/schema.go Outdated Show resolved Hide resolved
@rumyantseva rumyantseva requested a review from AlekSi July 26, 2022 21:16
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 looks good, got a small question about test.

internal/tjson/schema_test.go Outdated Show resolved Hide resolved
w84thesun
w84thesun previously approved these changes Jul 27, 2022
@AlekSi AlekSi enabled auto-merge (squash) July 27, 2022 12:19
@AlekSi AlekSi added this to the v0.6.0 milestone Jul 27, 2022
internal/tjson/schema.go Outdated Show resolved Hide resolved
internal/tjson/schema_test.go Outdated Show resolved Hide resolved
AlekSi and others added 2 commits July 27, 2022 15:25
Co-authored-by: Alexey Palazhchenko <alexey.palazhchenko@gmail.com>
AlekSi
AlekSi previously approved these changes Jul 27, 2022
w84thesun
w84thesun previously approved these changes Jul 27, 2022
noisersup
noisersup previously approved these changes Jul 27, 2022
@rumyantseva rumyantseva dismissed stale reviews from noisersup, w84thesun, and AlekSi via 7c6c160 July 27, 2022 13:00
@AlekSi AlekSi disabled auto-merge July 27, 2022 13:09
@AlekSi AlekSi merged commit 31510a8 into FerretDB:main Jul 27, 2022
@rumyantseva rumyantseva deleted the issue-907-fix-schema-comp branch August 8, 2022 10:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code/chore Code maintenance improvements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

tjson: Fix schema comparison
4 participants