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

@nrwl/tao fail to validate schema correctly #4484

Closed
AliYusuf95 opened this issue Jan 10, 2021 · 1 comment · Fixed by #4485
Closed

@nrwl/tao fail to validate schema correctly #4484

AliYusuf95 opened this issue Jan 10, 2021 · 1 comment · Fixed by #4485
Assignees
Labels

Comments

@AliYusuf95
Copy link
Contributor

Current Behavior

when generating a new angular component I get this error:
Property 'prefix' does not match the schema.

I traced the issue it's caused by @nrwl/tao when it tries to validate the options:

if (typeof value !== normalizedPrimitiveType(schema.type)) {

The thing is as the prefix is oneOf rule and each item doesn't contain type property since it depends on the main rule type

schema.oneOf.forEach((r) => {
try {
validateProperty(propName, value, r, definitions);
passes = true;
} catch (e) {}
});
if (!passes) throwInvalidSchema(propName, schema);

Expected Behavior

Generate component successfully

Steps to Reproduce

Just provide prefix params in the generate command like:
nx generate @schematics/angular:component test --project frontend --prefix app --dryRun
nx generate @nrwl/angular:component test --project frontend --prefix app --dryRun

or set a default value for it from angular.json:

//....
    "schematics": {
        "@schematics/angular:component": {
            "prefix": "app",
            "style": "scss"
        },
        "@nrwl/angular:component": {
            "prefix": "app",
            "style": "scss"
        }
    }
//....

Failure Logs

Property 'prefix' does not match the schema.
{
  "type": "string",
  "description": "The prefix to apply to the generated component selector.",
  "alias": "p",
  "oneOf": [
    {
      "maxLength": 0
    },
    {
      "minLength": 1,
      "format": "html-selector"
    }
  ]
}'

Environment

  Node : 14.15.0
  OS   : darwin x64
  yarn : 1.22.10
  
  nx : Not Found
  @nrwl/angular : 11.0.20
  @nrwl/cli : 11.0.20
  @nrwl/cypress : 11.0.20
  @nrwl/devkit : 11.0.20
  @nrwl/eslint-plugin-nx : 11.0.20
  @nrwl/express : Not Found
  @nrwl/jest : 11.0.20
  @nrwl/linter : 11.0.20
  @nrwl/nest : 11.0.20
  @nrwl/next : Not Found
  @nrwl/node : 11.0.20
  @nrwl/react : Not Found
  @nrwl/schematics : Not Found
  @nrwl/tao : 11.0.20
  @nrwl/web : Not Found
  @nrwl/workspace : 11.0.20
  typescript : 4.0.3
@github-actions
Copy link

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants