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

Array having size=0 cannot be generated #53

Closed
visko-sc opened this issue Apr 21, 2021 · 1 comment
Closed

Array having size=0 cannot be generated #53

visko-sc opened this issue Apr 21, 2021 · 1 comment

Comments

@visko-sc
Copy link

Having this template:

[
  {
    "collection": "collection",
    "count": 1,
    "content": {
      "users": {
        "type": "array",
        "size": 0
      }
    }
  }
]

The actual result is:

error in configuration:
  fail to create collection collection: invalid generator for field 'key'
  cause: make sure that 'size' >= 0

And the expected result:

[
  {
    "_id": ObjectId("5a934e000102030405000000"),
    "users": []
  }
]

I can see a bug in collinfo.go:542 (it should be if config.Size < 0), but even if that is fixed, an "arrayContent" is also required in line 545 which would be unnecessary for an empty array.

feliixx added a commit that referenced this issue Apr 26, 2021
array generator with size 0 are allowed, they just create
an empty array ( translated to a constGenerator with val = [ ] )

closes #53
@feliixx
Copy link
Owner

feliixx commented Apr 26, 2021

thanks for the report, it should work fine with the new release: version 0.9.1

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

No branches or pull requests

2 participants