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

Support mongoose array fields #94

Merged
merged 2 commits into from
May 25, 2017
Merged

Support mongoose array fields #94

merged 2 commits into from
May 25, 2017

Conversation

JCMais
Copy link
Contributor

@JCMais JCMais commented May 22, 2017

Fixes #81

@codecov
Copy link

codecov bot commented May 23, 2017

Codecov Report

Merging #94 into master will increase coverage by 4.24%.
The diff coverage is 95.74%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #94      +/-   ##
==========================================
+ Coverage   59.01%   63.26%   +4.24%     
==========================================
  Files          13       13              
  Lines         305      343      +38     
==========================================
+ Hits          180      217      +37     
- Misses        125      126       +1
Impacted Files Coverage Δ
packages/generator/src/utils.js 95.65% <95.74%> (+0.65%) ⬆️

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 81e0ded...a093882. Read the comment docs.

Copy link
Collaborator

@lucasbento lucasbento left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks really good, we are just missing one way of defining an array on mongoose:

{
  // ...
  myArrayField: {
    type: [String],
  },
  // ...
}

Would you mind adding this case, @JCMais? We can merge it after that, this is an awesome work!

@JCMais
Copy link
Contributor Author

JCMais commented May 24, 2017

@lucasbento the following is now supported:

{
  array1: [String],
  array2: {
    type: [String],
    description: 'Some description'
  },
  array3: [
    {
      type: ObjectId,
      ref: 'AnotherModel',
    },
  ],
  array4: {
    type: [ObjectId],
    ref: 'AnotherModel',
    description: 'Some description'
  }
}

I'm mutating the AST though, so I don't know if you have any problem with that.

Copy link
Collaborator

@lucasbento lucasbento left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome work, thank you, @JCMais!

@lucasbento lucasbento merged commit 4882069 into aerogear:master May 25, 2017
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