Skip to content

Merge-PodeOAProperty

SYNOPSIS

Creates a new OpenAPI object combining schemas and properties.

SYNTAX

Merge-PodeOAProperty [[-ParamsList] <Hashtable[]>] [-Type] <String> [[-ObjectDefinitions] <Object[]>]
 [[-DiscriminatorProperty] <String>] [[-DiscriminatorMapping] <Hashtable>] [-ProgressAction <ActionPreference>]
 [<CommonParameters>]

DESCRIPTION

Creates a new OpenAPI object combining schemas and properties.

EXAMPLES

EXAMPLE 1

Add-PodeOAComponentSchema -Name 'Pets' -Component (  Merge-PodeOAProperty  -Type OneOf -ObjectDefinitions @( 'Cat','Dog') -Discriminator "petType")

EXAMPLE 2

Add-PodeOAComponentSchema -Name 'Cat' -Component (
        Merge-PodeOAProperty  -Type AllOf -ObjectDefinitions @( 'Pet', ( New-PodeOAObjectProperty -Properties @(
                (New-PodeOAStringProperty -Name 'huntingSkill' -Description 'The measured skill for hunting' -Enum @(  'clueless', 'lazy', 'adventurous', 'aggressive'))
                ))
        ))

PARAMETERS

-DiscriminatorMapping

If supplied, define a mapping between the values of the discriminator property and the corresponding subtype schemas. This parameter accepts a HashTable where each key-value pair maps a discriminator value to a specific subtype schema name. It's used in conjunction with the -DiscriminatorProperty to provide complete discrimination logic in polymorphic scenarios.

Type: Hashtable
Parameter Sets: (All)
Aliases:

Required: False
Position: 5
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-DiscriminatorProperty

If supplied, specifies the name of the property used to distinguish between different subtypes in a polymorphic schema in OpenAPI. This string value represents the property in the payload that indicates which specific subtype schema should be applied. It's essential in scenarios where an API endpoint handles data that conforms to one of several derived schemas from a common base schema.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: 4
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-ObjectDefinitions

An array of object definitions that are used for independent validation but together compose a single object.

Type: Object[]
Parameter Sets: (All)
Aliases:

Required: False
Position: 3
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-ParamsList

Used to pipeline an object definition

Type: Hashtable[]
Parameter Sets: (All)
Aliases:

Required: False
Position: 1
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False

-ProgressAction

{{ Fill ProgressAction Description }}

Type: ActionPreference
Parameter Sets: (All)
Aliases: proga

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Type

Define the type of validation between the objects oneOf - validates the value against exactly one of the subschemas allOf - validates the value against all the subschemas anyOf - validates the value against any (one or more) of the subschemas

Type: String
Parameter Sets: (All)
Aliases:

Required: True
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

OUTPUTS

System.Collections.Specialized.OrderedDictionary

NOTES

https://swagger.io/docs/specification/basic-structure/

https://swagger.io/docs/specification/data-models/