Skip to content

fix(@schematics/angular): default interface for guard #15313

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

Merged
merged 1 commit into from
Aug 16, 2019

Conversation

cexbrayat
Copy link
Member

Currently, if the user hits <Enter> before selecting an interface to implement, the CLI will generate a broken guard that implements no interface. With this commit, the CLI generates a CanActivate guard by default.

Copy link
Collaborator

@alan-agius4 alan-agius4 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this, see above.

Also, this commit should probably be a fix

@alan-agius4 alan-agius4 self-assigned this Aug 12, 2019
@clydin
Copy link
Member

clydin commented Aug 12, 2019

What about adding "minItems": 1, to the schema for the option? A guard without any of them doesn't really make sense.

@alan-agius4
Copy link
Collaborator

I think the combination of all the suggested above. Will fix this schematic for both interactive and not. As at the moment when not interactive the valid implementation is too loose.

@cexbrayat cexbrayat force-pushed the feat/default-guard-interface branch from cd20e84 to 9b3d508 Compare August 16, 2019 08:02
@cexbrayat cexbrayat changed the title feat(@schematics/angular): default interface for guard fix(@schematics/angular): default interface for guard Aug 16, 2019
@cexbrayat
Copy link
Member Author

@alan-agius4 I amended the commit with your suggestions and @clydin 's 👍 That should handle the interactive and non interactive cases.

@cexbrayat cexbrayat force-pushed the feat/default-guard-interface branch from 9b3d508 to c3d15b6 Compare August 16, 2019 11:49
Currently, if the user hits `<Enter>` before selecting an interface to implement, the CLI generates a broken guard that implements no interface. With this commit, the CLI forces a choice in interactive mode and generates a `CanActivate` guard by default.
Copy link
Collaborator

@alan-agius4 alan-agius4 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for this.

@alan-agius4 alan-agius4 added the target: patch This PR is targeted for the next patch release label Aug 16, 2019
@cexbrayat cexbrayat force-pushed the feat/default-guard-interface branch from c3d15b6 to f48286e Compare August 16, 2019 11:55
@kyliau kyliau merged commit 78b408f into angular:master Aug 16, 2019
@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 16, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants