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

strapi generate api without further arguments leads to error #36

Closed
crunchtime-ali opened this issue Nov 20, 2015 · 2 comments
Closed
Labels
issue: bug Issue reporting a bug
Milestone

Comments

@crunchtime-ali
Copy link
Contributor

Well this one is pretty easy but i'll hand to yourself how you want to fix it.

This code is from https://github.com/wistityhq/strapi-generate-api/blob/master/lib/before.js
When executing strapi generate api pluralize doesn't handle the undefined gracefully so we have to do it ourself.

TypeError: Cannot read property 'toLowerCase' of undefined
  // `scope.args` are the raw command line arguments.
  _.defaults(scope, {
    id: scope.args[0],
    idPluralized: pluralize.plural(scope.args[0]),
    attributes: _.slice(scope.args, 1)
  });

  // Validate custom scope variables which are required by this generator.
  if (!scope.rootPath || !scope.id) {
    return cb.invalid('Usage: `$ strapi generate api <myAPI> [attribute|attribute:type ...]`');
  }
@loicsaintroch loicsaintroch self-assigned this Nov 20, 2015
@loicsaintroch loicsaintroch added this to the v1.4.0 milestone Nov 20, 2015
@loicsaintroch loicsaintroch added issue: bug Issue reporting a bug framework labels Nov 20, 2015
@loicsaintroch
Copy link

Interesting, thank you @dj-hedgehog I'll take a look at it in the next few days.

@loicsaintroch loicsaintroch modified the milestones: v1.5.0, v1.4.0 Nov 24, 2015
@loicsaintroch
Copy link

Hey @dj-hedgehog, just fixed this issue on the strapi-generate-api repository: https://github.com/wistityhq/strapi-generate-api/commit/4817b3d87107a66c716928f83ca9c2b0b8fad9a0.

Thank you for your help.

@strapi strapi locked and limited conversation to collaborators Dec 10, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
issue: bug Issue reporting a bug
Projects
None yet
Development

No branches or pull requests

2 participants