angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

Mismatch in schema name validation

Open antongakh opened this issue 1 year ago • 3 comments

Command

new

Is this a regression?

  • [ ] Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

No response

Description

There is a possibility to create an application with the ng new command with the name which makes it impossible to configure it through the ng config command.

Minimal Reproduction

  1. generate new application with ng new my.application
  2. run any ng config command in generated application (e.g. ng config schematics.@schematics/angular:component.style scss)
  3. Observe command output

ER: Command executed correctly AR: Error: Error: Schema validation failed with the following errors: Data path "/projects" must NOT have additional properties(my.application).

Exception or Error

Error: Schema validation failed with the following errors:
  Data path "/projects" must NOT have additional properties(my.application)

Your Environment

Angular CLI: 16.2.0
Node: 18.16.0
Package Manager: npm 9.5.1
OS: win32 x64

Angular: undefined
...

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.1602.0
@angular-devkit/core         16.2.0
@angular-devkit/schematics   16.2.0
@angular/cli                 16.2.0
@schematics/angular          16.2.0

Anything else relevant?

Application name is validated by: https://github.com/angular/angular-cli/blob/main/packages/schematics/angular/application/schema.json#L16 Project name is validated by: https://github.com/angular/angular-cli/blob/main/packages/angular/cli/lib/config/workspace-schema.json#L26C9-L26C47

antongakh avatar Aug 22 '23 12:08 antongakh

Hey there! I noticed the issue you raised about the schema validation error. I'm interested in helping out with this, but I want to make sure I understand the problem correctly.

Are we aiming to prevent users from having a dot (.) in the project name? Or is the goal to fix the 'ng config' command so that it doesn't throw the 'Schema validation failed' error?

By the way, I'm relatively new to open source contributions, so your guidance and insights would be greatly appreciated.

rishabh1S avatar Sep 25 '23 15:09 rishabh1S

I tried to reproduce the above issue and was able to reproduce it as well. As you can see in the screenshot below even the angular language service shows the warning for the project name. I think giving the dot in the name of the appllication should not be alllowed or it can be converted to "-" while creating the application. image image

harshlakhara avatar Jan 20 '24 08:01 harshlakhara

I have raised two PRs to fix the above issue #25704. Maintainer can either merge one of them to fix the issue. PR1: #26908 (This PR is to not accept the dot(.) in app name while doing "ng new") PR2: #26909 (This PR is to validate the projectName with dot(.) in it)

harshlakhara avatar Jan 20 '24 10:01 harshlakhara

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.