Skip to content
This repository has been archived by the owner on Aug 25, 2024. It is now read-only.

RFC - RE: Pipeline input. How should this be handled? #12

Closed
ArtisanByteCrafter opened this issue May 22, 2019 · 1 comment
Closed

RFC - RE: Pipeline input. How should this be handled? #12

ArtisanByteCrafter opened this issue May 22, 2019 · 1 comment
Assignees
Labels
breaking-changes enhancement New feature or request RFC an RFC open to the community
Milestone

Comments

@ArtisanByteCrafter
Copy link
Owner

All exposed functions should accept pipeline input. In order to accomplish this the traditional Powershell way, objects in the pipeline should have the properties expected by the funtions being piped to, however the API returns objects one level higher than that. Changing this output would be a major breaking change, and should be considered very carefully.

There are two options:

1) Leave output alone and simply query one level deep before piping:

$query = Get-SmaMachineInventory .....
$Query.Machines | Set-SmaMachineInventory ....

Advantages:

  • No breaking change needed

Disadvantages:

  • Contrary to best practice in pipeline input
  • Would cause confusion for those expecting traditional pipeline behavior

2) Format output to remove top-level parameters Count and Warning, and only return results:

Get-SmaMachineInventory .... | Set-SmaMachinenventory ....

Advantages:

  • Best practice in handling pipeline input
  • Could take advantage of pipeline parallelism to improve performance on longer queries

Disadvantages:

  • Major breaking change. Any scripts that use syntax like $Query.Machines to retrieve objects would need to be re-written to simply use $Query. This would apply to all endpoints.
  • Note Properties Count and Warnings would not be returned with the request, although traditional count methods would still be easily usable. (.count , | Measure-Object, etc.)

I'm leaning towards a phased approach, i.e. enabling pipeline input like in option 1, so as not to break anything, then at some point in the future, simply making the switch to v2 after a warning has been out for a while.

@ArtisanByteCrafter ArtisanByteCrafter self-assigned this May 22, 2019
@ArtisanByteCrafter ArtisanByteCrafter added the RFC an RFC open to the community label May 22, 2019
@ArtisanByteCrafter ArtisanByteCrafter pinned this issue May 22, 2019
@ArtisanByteCrafter ArtisanByteCrafter added the enhancement New feature or request label Oct 31, 2019
@ArtisanByteCrafter ArtisanByteCrafter added this to the 2.0 milestone Oct 31, 2019
@ArtisanByteCrafter
Copy link
Owner Author

ArtisanByteCrafter commented Nov 13, 2019

This is now implemented as of 1580db5

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
breaking-changes enhancement New feature or request RFC an RFC open to the community
Projects
None yet
Development

No branches or pull requests

1 participant