Open milanholemans opened 1 week ago
I am all in on extending this the output to make other folks life easier, on the other hand I don't like when we modify the default API response to our output as then it produce some additional maintenance around that 🤔.
What if we do not add it to the default output of those commands but instead add and additional option like withParent
or something similar and then add this additional information to the output? Also then I would not trim the output but return the entire content type.
What do you think?
@pnp/cli-for-microsoft-365-maintainers any other feed on that?
I'm open to suggestions, but if we add a new flag for this, it will produce more maintenance than if we include it by default? No?
in terms of maintenance I meant that we modify the API response. If this API response would change then potentially the command breaks. If we do not modify the response or add it as a optional (when some option is defined) kind of thing then there will be no problem when API response would change in the default command run
But if we add properties to command output it won't break anything, right? Only if we remove stuff from the response.
no it does not break anything. I described a scenario that when an default API response change and our command does not return the default response but modified version of it then usually the command breaks. That is why I usually vote to return exactly the same as the API response if possible
We're not really changing the response. The only thing we do is add ?$expand=Parent&$select=Parent/Id,Parent/Name,...
to the already existing API request.
For me it makes sense to add the Parent property. I would add it by default too.
?$expand=Parent
ok I the original issue I thought we will just add ?$expand=Parent
and trim the output in code. In this case it makes sense
I opt for also adding the parent to the response.
Currently, we can list content types in sites and lists, but when using quite some content types that inherit from the same content type (e.g.
Site Page X
inherits fromSite Page Y
which inherits fromSite Page
), it can become really difficult to check which content type inherits from which. I suggest that we enhance the output with the Parent property. This way the user can easily check which content type inherits from which.Commands to update:
spo list contenttype list
spo contenttype list
spo contenttype get
API:
Since Parent returns the entire content type of the parent, I suggest we only retrieve properties
Id
,StringId
,Name
,Group
.Output would look something like this: