contentstack/datasync-filesystem-sdk

[BUG]: Add validations to .tag() method

iyerrama29 opened this issue · 2 comments

Describe the bug

  • .tag() method accepts an empty array

To Reproduce

Query a content type
Create a query that uses to filter by tags
In the query, enter an empty array

Notice: The result is empty. In contentstack-javascript the result is all the entries. Thus, the behaviour is different in both

Query

Stack.contentType('blog')
  .entries()
  .tags([])
  .find()

Expected behavior
The query should be invalidated OR throw errors

For future references: If you wish to query for an empty 'Array' field, use $size operator inside query

// example
Stack.contentType('blog')
  .entries()
  .query({tags: {$size: 0}})

Regards,
Ramanathan K

A quick update

  • The above issue's patch will be part of hotfix/1.0.2 release.
  • The behaviour will be the same as the one received via Contentstack's API response / contentstack-javascript

Closing this. The has been fixed in hotfix/1.0.2