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

Enhancement: Allow unknown options for entra group/app/administrativeunit commands. Closes #6314 #6543

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

MartinM85
Copy link
Contributor

Closes #6314

@milanholemans
Copy link
Contributor

Thanks, we'll try to look at it ASAP.

@martinlingstuyl martinlingstuyl self-assigned this Feb 1, 2025
Copy link
Contributor

@martinlingstuyl martinlingstuyl left a comment

Choose a reason for hiding this comment

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

a comment

options: AppCreationOptions,
apis: RequiredResourceAccess[],
logger: Logger,
verbose: boolean,
debug: boolean
debug: boolean,
command: Command
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm unsure what to think of this... I understand we need to call the addUnknownOptionsToPayload method which is on the command class. But still, it seems a bit odd to have to pass around the entire command as a parameter. Added to that we have to pass debug and verbose as parameters as well, which are on the command class as protected properties, so you can't call them from here unless you pass them separately.

Copy link
Contributor

Choose a reason for hiding this comment

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

I see you also need to make addUnknownOptionsToPayload public instead of private for this to work.

Maybe as an alternative we could pass a delegate function into this util instead. The delegate in its stead calls the addUnknownOptionsToPayload from the command itself.

What do you think @pnp/cli-for-microsoft-365-maintainers?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The current solution is definitely not the best. I wanted to avoid major refactoring...

Copy link
Contributor

Choose a reason for hiding this comment

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

Yea I understand, which is why I think a delegate function parameter (or callback function) is better, but let's see what the other maintainers think...

Copy link
Member

Choose a reason for hiding this comment

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

Passing the whole command as an arg is definitely not the way to go. I agree that we should make addUnknownOptionsToPayload more accessible from utils. Since it will become pretty generic (basically merging two objects), we need to consider a refactoring. No easy way out here unfortunately. Good call @martinlingstuyl 👏

Copy link
Contributor Author

@MartinM85 MartinM85 Feb 2, 2025

Choose a reason for hiding this comment

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

Moving to the optionsUtil should be possible.

Copy link
Contributor Author

@MartinM85 MartinM85 Feb 2, 2025

Choose a reason for hiding this comment

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

It seems to me that the callback function is causing tests failure for macOs (https://github.com/pnp/cli-microsoft365/actions/runs/13099770947/job/36546562680) when the npm run lint is executed.

Same for the optionsUtils.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The addUnknownOptionsToPayload and getUnknownOptions moved to the optionsUtils.

Copy link
Contributor

Choose a reason for hiding this comment

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

You're being a bit fast 😂 we needed to discuss and decide first. but let's see what you built, can you push the commit? It's okay if the tests aren't finished...

That way we can see if this is indeed the direction to go

Copy link
Member

Choose a reason for hiding this comment

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

@martinlingstuyl TBH the current approach (I think the latest) seems clear and fine for me. I don't see any risks with this approach I guess.
@MartinM85 the error you mentioned on MacOs is actually connected to out of memory issue on GH workflow.
image

I don't expect it to be because of your current development. I think we already noticed it also randomly failing in other places as well

Copy link
Contributor

@martinlingstuyl martinlingstuyl left a comment

Choose a reason for hiding this comment

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

Some additional comments....

src/m365/entra/commands/app/app-set.ts Outdated Show resolved Hide resolved
options: AppCreationOptions,
apis: RequiredResourceAccess[],
logger: Logger,
verbose: boolean,
debug: boolean
debug: boolean,
command: Command
Copy link
Contributor

Choose a reason for hiding this comment

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

I see you also need to make addUnknownOptionsToPayload public instead of private for this to work.

Maybe as an alternative we could pass a delegate function into this util instead. The delegate in its stead calls the addUnknownOptionsToPayload from the command itself.

What do you think @pnp/cli-for-microsoft-365-maintainers?

@MartinM85 MartinM85 force-pushed the feature/6314-allow-unknown-options branch from cc64776 to 5997c49 Compare February 2, 2025 17:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enhancement: Allow unknown options for entra group/app/administrativeunit commands
5 participants