Skip to content

ng get causes InvalidJsonPath error #5886

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

Closed
fmorriso opened this issue Apr 8, 2017 · 11 comments
Closed

ng get causes InvalidJsonPath error #5886

fmorriso opened this issue Apr 8, 2017 · 11 comments

Comments

@fmorriso
Copy link

fmorriso commented Apr 8, 2017

Versions.

ps>ng --version
_ _ ____ _ ___
/ \ _ __ __ _ _ | | __ _ _ __ / | | | |
/ △ \ | '
\ / _ | | | | |/ _ | '
| | | | | | |
/ ___ | | | | (
| | || | | (| | | | || | | |
// __| ||_, |_,||_,|| _|||
|___/
@angular/cli: 1.0.0
node: 7.7.2
os: win32 x64
@angular/common: 4.0.1
@angular/compiler: 4.0.1
@angular/core: 4.0.1
@angular/forms: 4.0.1
@angular/http: 4.0.1
@angular/platform-browser: 4.0.1
@angular/platform-browser-dynamic: 4.0.1
@angular/router: 4.0.1
@angular/cli: 1.0.0
@angular/compiler-cli: 4.0.1

Repro steps.

  1. Navigate to an existing directory that was created via ng new, such as ng new angular-hello.
  2. Open a prompt at the location of the project directory. Example c:\projects\angular-hello
  3. ng get

The log given by the failure.

ps>ng get --verbose
The option '--verbose' is not registered with the get command. Run ng get --help for a list of supported options.
InvalidJsonPath
Error: InvalidJsonPath
at _parseJsonPath (C:\projects\angular-hello\node_modules@ngtools\json-schema\src\schema-class-factory.js:29:19)
at _getSchemaNodeForPath (C:\projects\angular-hello\node_modules@ngtools\json-schema\src\schema-class-factory.js:41
:21)
at GeneratedSchemaClass.$$get (C:\projects\angular-hello\node_modules@ngtools\json-schema\src\schema-class-factory.
js:84:22)
at CliConfig.get (C:\projects\angular-hello\node_modules@angular\cli\models\config\config.js:31:29)
at resolve (C:\projects\angular-hello\node_modules@angular\cli\commands\get.js:25:34)
at Class.run (C:\projects\angular-hello\node_modules@angular\cli\commands\get.js:19:16)
at Class. (C:\projects\angular-hello\node_modules@angular\cli\ember-cli\lib\models\command.js:134:17)
at process._tickCallback (internal/process/next_tick.js:109:7)

Desired functionality.

Eliminate the InvalidJsonPath error

Mention any other details that might be useful.

  1. ng build of the project works.
  2. ng serve of the project works.
@fmorriso
Copy link
Author

fmorriso commented Apr 8, 2017

@fmorriso fmorriso closed this as completed Apr 8, 2017
@fmorriso fmorriso reopened this Apr 8, 2017
@fmorriso
Copy link
Author

fmorriso commented Apr 8, 2017

accidentally closed issue when I only meant to close the file upload.

@prestonvanloon
Copy link
Contributor

This is being thrown from _parseJsonPath.

According to the function comment: For example, a path of "a[3].foo.bar[2]" would give you a fragment array of ["a", 3, "foo", "bar", 2].

Do you get this same error when you specify a path such as a[3].foo.bar[2] (i.e. ng get a[3].foo.bar[2])?

@sumitarora sumitarora self-assigned this Apr 8, 2017
@prestonvanloon
Copy link
Contributor

@sumitarora I can submit a fix for this in a few minutes.

@sumitarora
Copy link
Contributor

@prestonvanloon sure 👍

@fmorriso
Copy link
Author

fmorriso commented Apr 8, 2017

Thanks for the quick attention. I visited the docs section of the repository looking for ng get but was unable to find what the valid built-in keys are or how determine which keys are available to "get" or "set".

Suggestion:

  1. create Get.md and Set.md.

  2. Then add them to the repository at the following location:
    https://github.com/angular/angular-cli/tree/master/docs/documentation

@prestonvanloon
Copy link
Contributor

@fmorriso the related documentation is under the configuration doc. I do see your point of not knowing the built in keys. Originally, I proposed throwing a reasonable error when no key is provided. However, I think a better implementation would be to return the whole config object for display when no specific key provided.

I'll update #5887 to return the proper config object.

@fmorriso
Copy link
Author

Putting what should be inside Get.md and Set.md in something non-obvious like Config.md seems curious at best. When I want information about ng build I look in Build.md, so why not put ng get and ng set into Get.md and Set.md respectively?

@prestonvanloon
Copy link
Contributor

@fmorriso I agree, it's not intuitive to have get/set commands live under config.md.

@filipesilva can you weigh in?

@alan-agius4
Copy link
Collaborator

Thanks for reporting this issue. This issue is now obsolete due to changes in the recent releases. Please update to the most recent Angular CLI version.

If the problem persists after upgrading, please open a new issue, provide a simple repository reproducing the problem, and describe the difference between the expected and current behavior.

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
4 participants