Pode icon indicating copy to clipboard operation
Pode copied to clipboard

Support for OpenAPI properties Piping

Open mdaneri opened this issue 1 year ago • 0 comments

Describe the Feature

Pode supports the creation of OpenAPI properties using five different functions. These properties can be aggregated to form an object. The issue is that these functions cannot be piped to create the object but must be assigned to an array of hashtables.

This behavior is not very 'PowerShell' and this feature is to change it

###Function Impacted

  • New-PodeOAIntProperty
  • New-PodeOANumberProperty
  • New-PodeOAStringProperty
  • New-PodeOABoolProperty
  • New-PodeOAObjectProperty
  • New-PodeOASchemaProperty
  • New-PodeOAMultiTypeProperty

Examples

Previous versions

Add-PodeOAComponentSchema -Name 'Address' -Schema (
        New-PodeOAObjectProperty -Name 'Address' -XmlName  'address' } -Description 'Shipping Address' -Properties (
            (New-PodeOAStringProperty -Name 'street' -Example '437 Lytton' -Required),
                (New-PodeOAStringProperty -Name 'city' -Example 'Palo Alto' -Required),
                (New-PodeOAStringProperty -Name 'state' -Example 'CA' -Required),
                (New-PodeOAStringProperty -Name 'zip' -Example '94031' -Required)
        ))

Now

New-PodeOAStringProperty -Name 'street' -Example '437 Lytton' -Required |
            New-PodeOAStringProperty -Name 'city' -Example 'Palo Alto' -Required |
            New-PodeOAStringProperty -Name 'state' -Example 'CA' -Required |
            New-PodeOAStringProperty -Name 'zip' -Example '94031' -Required |
            New-PodeOAObjectProperty -Name 'Address' -XmlName 'address' -Description 'Shipping Address' |
            Add-PodeOAComponentSchema -Name 'Address'

mdaneri avatar Dec 25 '23 00:12 mdaneri