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 unique fields only capability to schema #7388

Open
wants to merge 3 commits into
base: alpha
Choose a base branch
from

Conversation

fn-faisal
Copy link
Member

@fn-faisal fn-faisal commented May 15, 2021

New Pull Request Checklist

Issue Description

Add an option to ignore parse default fields while creating a schema.

Related issue: #6059

Approach

Add request object serialisation to the create schema endpoint such that when a transform option is provided either in the request body or params, parse server performs the required serialisation before handing the object over to controller for saving.
For this issue, only one serialisation option has been added i.e. ignoreDefaultFields . ignoreDefaultFields option removes the default field from request object before saving schema and no error is sent to the requesting client app.

eg body options:

{
    "options": {
        "ignoreDefaultFields": true
    },
    "className": "Another",
    "fields": {
        "objectId": {
            "type": "String"
        },
        "name": {
            "type": "String"
        }
    }
}

eg response:

{
    "className": "Another",
    "fields": {
        "objectId": {
            "type": "String"
        },
        "updatedAt": {
            "type": "Date"
        },
        "createdAt": {
            "type": "Date"
        },
        "name": {
            "type": "String"
        },
        "ACL": {
            "type": "ACL"
        }
    },
    "classLevelPermissions": {
        "find": {
            "*": true
        },
        "count": {
            "*": true
        },
        "get": {
            "*": true
        },
        "create": {
            "*": true
        },
        "update": {
            "*": true
        },
        "delete": {
            "*": true
        },
        "addField": {
            "*": true
        },
        "protectedFields": {
            "*": []
        }
    }
}

eg query params:
http://localhost:1337/parse/schemas/Another?ignoreDefaultFields=true

TODOs before merging

  • Add test cases
  • Add entry to changelog
  • Add changes to documentation (guides, repository pages, in-code descriptions)
  • Add security check
  • Add new Parse Error codes to Parse JS SDK
  • ...

@mtrezza
Copy link
Member

mtrezza commented May 16, 2021

Thanks for this PR. Can you please reference the corresponding existing issue or create a new issue?

@fn-faisal
Copy link
Member Author

@mtrezza this is in reference to the issue below.
#6059

@mtrezza
Copy link
Member

mtrezza commented May 17, 2021

I added the issue link to your initial post and also did some reformatting.

@codecov
Copy link

codecov bot commented May 17, 2021

Codecov Report

Merging #7388 (38d0e63) into alpha (bdf73a0) will decrease coverage by 0.00%.
The diff coverage is 96.15%.

Impacted file tree graph

@@            Coverage Diff             @@
##            alpha    #7388      +/-   ##
==========================================
- Coverage   93.92%   93.91%   -0.01%     
==========================================
  Files         181      181              
  Lines       13209    13235      +26     
==========================================
+ Hits        12406    12430      +24     
- Misses        803      805       +2     
Impacted Files Coverage Δ
src/Routers/SchemasRouter.js 96.92% <94.44%> (-0.95%) ⬇️
src/Controllers/SchemaController.js 97.38% <100.00%> (+0.02%) ⬆️
src/Utils.js 95.91% <100.00%> (+0.17%) ⬆️
src/Adapters/Storage/Mongo/MongoStorageAdapter.js 92.59% <0.00%> (-0.66%) ⬇️
src/RestWrite.js 94.08% <0.00%> (+0.15%) ⬆️
src/batch.js 93.10% <0.00%> (+1.72%) ⬆️

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 bdf73a0...38d0e63. Read the comment docs.

@mtrezza
Copy link
Member

mtrezza commented Sep 3, 2021

⚠️ Important change for merging PRs from Parse Server 5.0 onwards!

We are planning to release the first beta version of Parse Server 5.0 in October 2021.

If a PR contains a breaking change and is not merged before the beta release of Parse Server 5.0, it cannot be merged until the end of 2022. Instead it has to follow the Deprecation Policy and phase-in breaking changes to be merged during the course of 2022.

One of the most voiced community feedbacks was the demand for predictability in breaking changes to make it easy to upgrade Parse Server. We have made a first step towards this by introducing the Deprecation Policy in February 2021 that assists to phase-in breaking changes, giving developers time to adapt. We will follow-up with the introduction of Release Automation and a branch model that will allow breaking changes only with a new major release, scheduled for the beginning of each calendar year.

We understand that some PRs are a long time in the making and we very much appreciate your contribution. We want to make it easy for PRs that contain a breaking change and were created before the introduction of the Deprecation Policy. These PRs can be merged with a breaking change without being phased-in before the beta release of Parse Server 5.0. We are making this exception because we appreciate that this is a time of transition that requires additional effort from contributors to adapt. We encourage everyone to prepare their PRs until the end of September and account for review time and possible adaptions.

If a PR contains a breaking change and should be merged before the beta release, please mention @parse-community/server-maintenance and we will coordinate with you to merge the PR.

Thanks for your contribution and support during this transition to Parse Server release automation!

@mtrezza
Copy link
Member

mtrezza commented Sep 10, 2021

@fn-faisal Could you please resole the conflicts? Is this PR ready for review?

@parse-github-assistant
Copy link

parse-github-assistant bot commented Dec 30, 2021

Thanks for opening this pull request!

  • 🎉 We are excited about your hands-on contribution!

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.

3 participants