| external help file | schema-help.xml |
|---|---|
| Module Name | schema |
| online version | https://github.com/SchemaModule/PowerShell/blob/master/docs/Format-SchemaDocument.md#format-schemadocument |
| schema | 2.0.0 |
A simple schema linter
Format-SchemaDocument [-json] <String> [<CommonParameters>]
A simple schema linter to output classes into a format that the schema definition would expect. Limitations of PowerShell prevent property names from starting with '$' so the linter updates values like id,schema,definitions,references to be pre-fixed with a '$'.
$Schema|ConvertTo-Json-Depth 1|Format-SchemaDocument
{
"type": "object","$schema": "http://json-schema.org/draft-07/schema#","additionalProperties": true,"$definitions": null,"$id": "http://example.com/example.json","properties": {
"width": "schemaString","depth": "schemaString","closet": "schemaBoolean","room": "schemaString","contents": "schemaArray","exterioraccess": "schemaBoolean"
},"required": [
"room","width","depth","closet","exterioraccess","contents"
],"title": "The root schema","description": "The root schema comprises the entire JSON document.","default": {
}
}This example shows how to use this function, we have restricted the ConvertTo-Json Cmdlet to a depth of 1 to keep this help readable.
This is a json string object to be formatted.
Type: System.StringParameter Sets: (All)Aliases:
Required: TruePosition: 0Default value: NoneAccept pipeline input: True (ByValue)Accept wildcard characters: FalseThis cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.