Skip to content

Fix: Proper handling of arrays for cloud validator #7178

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

Merged
merged 2 commits into from
Feb 11, 2021

Conversation

dblythy
Copy link
Member

@dblythy dblythy commented Feb 11, 2021

New Pull Request Checklist

Issue Description

I've just realised that Cloud Validators fail with expected type array, even when an array is provided.

Here's the test that fails on the master:

  it('set params type allow array', async () => {
    Parse.Cloud.define(
      'hello',
      () => {
        return 'Hello world!';
      },
      {
        fields: {
          data: {
            type: Array,
          },
        },
      }
    );
    await Parse.Cloud.run('hello', { data: [{ foo: 'bar' }] });
  });

Related issue: closes #7179

@codecov
Copy link

codecov bot commented Feb 11, 2021

Codecov Report

Merging #7178 (5dcff5c) into master (7f47b04) will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #7178      +/-   ##
==========================================
+ Coverage   94.00%   94.02%   +0.01%     
==========================================
  Files         172      172              
  Lines       12835    12834       -1     
==========================================
+ Hits        12066    12067       +1     
+ Misses        769      767       -2     
Impacted Files Coverage Δ
src/triggers.js 94.58% <100.00%> (-0.02%) ⬇️
src/RestWrite.js 94.00% <0.00%> (+0.32%) ⬆️

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 7f47b04...6af725d. Read the comment docs.

@dplewis dplewis merged commit 27d56f0 into parse-community:master Feb 11, 2021
dplewis pushed a commit that referenced this pull request Feb 21, 2021
* fix: proper handling of arrays for cloud validator

* Update CloudCode.Validator.spec.js
@parseplatformorg
Copy link
Contributor

🎉 This change has been released in version 5.0.0-beta.1

@parseplatformorg parseplatformorg added the state:released-beta Released as beta version label Nov 1, 2021
@parseplatformorg
Copy link
Contributor

🎉 This change has been released in version 5.0.0

@parseplatformorg parseplatformorg added the state:released Released as stable version label Mar 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
state:released Released as stable version state:released-beta Released as beta version
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cloud validators fail with type: Array when an array is provided
3 participants