0

Whenever I run this command ng generate @angular/material:navigation dashboard the terminal shows this

The 'path' option in '__\Desktop\machine test\employee\node_modules@angular\material\schematics\ng-generate\navigation\schema.json' is using deprecated behaviour. 'workingDirectory' smart default provider should be used instead.(0 , validation_1.validateName) is not a function

Is there another way to implement schematics in my project...:)

I tried this:

"$default": {
  "$source": "projectName"
}

in path of schema.json

Deprecated behavior problem solved but the 'validation is not a function' still remains.

1 Answer 1

0

I'm making an assumption that the version of @angular-devkit/schematics-cli you're using is a newer version than the version of @angular/materials you're using, which is why you're seeing this message.


Previously when defining the "path" property in a schematic you would do the following in the schema.json for the schematic definition:

{
  ...
  "properties": {
    "path": {
      "type": "string",
      "format": "path",
      "description": "The path at which to create .README directory and files",
      "visible": false
    }
  }
}

When the schematic was run if no "path" arg was supplied a default would be correctly set.

This can be seen in the 13.0.x version the the angular material dashboard schematic


As the error suggests (although unless you know schematics it's admittedly not very helpful) the "path" definition needed to be updated to:

{
  ...
  "properties": {
    "path": {
      "type": "string",
      "format": "path",
      "description": "The path at which to create .README directory and files",
      "visible": false,
      "$default": {
        "$source": "workingDirectory"
      }
    }
  }
}

As can be seen in the 14.0.x version the the angular material dashboard schematic


"workingDirectory" as the error suggests is a 'smart default provider' that sets the default value of the path.

"projectName" is also a 'smart default provider' but it sets the default value as the project name, not the current path.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.