Skip to content

New-PodeJsonSchemaObject

SYNOPSIS

Creates an Object JSON Schema type definition.

SYNTAX

New-PodeJsonSchemaObject [[-Property] <Hashtable[]>] [[-MinProperties] <Int32>] [[-MaxProperties] <Int32>]
 [[-Description] <String>] [-ProgressAction <ActionPreference>] [<CommonParameters>]

DESCRIPTION

This function creates a JSON Schema type definition for an Object type.

EXAMPLES

EXAMPLE 1

# create a JSON Schema definition for an object with a required string property "name" and an optional integer property "age"
New-PodeJsonSchemaObject -Property @(
    (New-PodeJsonSchemaProperty -Name 'name' -Definition (New-PodeJsonSchemaString) -Required),
    (New-PodeJsonSchemaProperty -Name 'age' -Definition (New-PodeJsonSchemaInteger))
) -Description 'A person object with a required name and an optional age'

EXAMPLE 2

# create a JSON Schema definition for an object with no properties, but a description - can accept any number of properties
New-PodeJsonSchemaObject -Description 'An empty object with a description'

EXAMPLE 3

# create a JSON Schema definition for an object with a minimum of 1 property and a maximum of 5 properties
New-PodeJsonSchemaObject -MinProperties 1 -MaxProperties 5

PARAMETERS

-Description

An optional description.

Type: String
Parameter Sets: (All)
Aliases:

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

-MaxProperties

An optional maximum number of properties in the object.

Type: Int32
Parameter Sets: (All)
Aliases:

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

-MinProperties

An optional minimum number of properties in the object.

Type: Int32
Parameter Sets: (All)
Aliases:

Required: False
Position: 2
Default value: 0
Accept pipeline input: False
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

-Property

A hashtable representing the JSON Schema property definition for a property of the object. This parameter can be specified multiple times to define multiple properties. Property definitions should be created using the New-PodeJsonSchemaProperty function.

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

Required: False
Position: 1
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.Hashtable

NOTES