Skip to content

Issue 11 #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions docs/Get-SchemaArray.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ schema: 2.0.0
## SYNTAX

```
Get-SchemaArray [[-Schema] <Object>]
Get-SchemaArray [[-SchemaDocument] <Object>] [<CommonParameters>]
```

## DESCRIPTION
Expand All @@ -30,8 +30,8 @@ PS C:\> {{ Add example code here }}

## PARAMETERS

### -Schema
{{ Fill Schema Description }}
### -SchemaDocument
{{ Fill SchemaDocument Description }}

```yaml
Type: Object
Expand All @@ -41,17 +41,21 @@ Aliases:
Required: False
Position: 0
Default value: None
Accept pipeline input: False
Accept pipeline input: True (ByValue)
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](http://go.microsoft.com/fwlink/?LinkID=113216).

## INPUTS

### None
### System.Object

## OUTPUTS

### System.Object
### System.Array

## NOTES

## RELATED LINKS
10 changes: 7 additions & 3 deletions docs/Get-SchemaDocument.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ schema: 2.0.0
## SYNTAX

```
Get-SchemaDocument [[-Path] <String>]
Get-SchemaDocument [[-Path] <String>] [<CommonParameters>]
```

## DESCRIPTION
Expand Down Expand Up @@ -41,17 +41,21 @@ Aliases:
Required: False
Position: 0
Default value: None
Accept pipeline input: False
Accept pipeline input: True (ByValue)
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](http://go.microsoft.com/fwlink/?LinkID=113216).

## INPUTS

### None
### System.String

## OUTPUTS

### System.Object

## NOTES

## RELATED LINKS
14 changes: 9 additions & 5 deletions docs/Get-SchemaObject.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ schema: 2.0.0
## SYNTAX

```
Get-SchemaObject [[-Schema] <Object>]
Get-SchemaObject [[-SchemaDocument] <Object>] [<CommonParameters>]
```

## DESCRIPTION
Expand All @@ -30,8 +30,8 @@ PS C:\> {{ Add example code here }}

## PARAMETERS

### -Schema
{{ Fill Schema Description }}
### -SchemaDocument
{{ Fill SchemaDocument Description }}

```yaml
Type: Object
Expand All @@ -41,17 +41,21 @@ Aliases:
Required: False
Position: 0
Default value: None
Accept pipeline input: False
Accept pipeline input: True (ByValue)
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](http://go.microsoft.com/fwlink/?LinkID=113216).

## INPUTS

### None
### System.Object

## OUTPUTS

### System.Object

## NOTES

## RELATED LINKS
14 changes: 9 additions & 5 deletions docs/Get-SchemaProperty.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ schema: 2.0.0
## SYNTAX

```
Get-SchemaProperty [[-Schema] <Object>] [[-Name] <String>]
Get-SchemaProperty [[-SchemaDocument] <Object>] [[-Name] <String>] [<CommonParameters>]
```

## DESCRIPTION
Expand Down Expand Up @@ -45,8 +45,8 @@ Accept pipeline input: False
Accept wildcard characters: False
```

### -Schema
{{ Fill Schema Description }}
### -SchemaDocument
{{ Fill SchemaDocument Description }}

```yaml
Type: Object
Expand All @@ -56,17 +56,21 @@ Aliases:
Required: False
Position: 0
Default value: None
Accept pipeline input: False
Accept pipeline input: True (ByValue)
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](http://go.microsoft.com/fwlink/?LinkID=113216).

## INPUTS

### None
### System.Object

## OUTPUTS

### System.Object

## NOTES

## RELATED LINKS
18 changes: 9 additions & 9 deletions schema/schema.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ function Get-Object {
[OutputType([Object])]
param (
[Parameter(ValueFromPipeline)]
[object]$Schema
[object]$SchemaDocument
)

process {
$Properties = $Schema.properties | Get-Member -MemberType NoteProperty | Select-Object -ExpandProperty Name;
$Properties = $SchemaDocument.properties | Get-Member -MemberType NoteProperty | Select-Object -ExpandProperty Name;
$Members = @{};
foreach ($Property in $Properties) {
switch ($Schema.properties.$Property.type) {
switch ($SchemaDocument.properties.$Property.type) {
'object' {
$Members.Add($Property, (New-Object -TypeName psobject -Property @{}))
}
Expand All @@ -71,14 +71,14 @@ function Get-Array {
[OutputType([Array])]
param (
[Parameter(ValueFromPipeline)]
[object]$Schema
[object]$SchemaDocument
)

process {
$Properties = $Schema.items.anyOf.properties | Get-Member -MemberType NoteProperty | Select-Object -ExpandProperty Name;
$Properties = $SchemaDocument.items.anyOf.properties | Get-Member -MemberType NoteProperty | Select-Object -ExpandProperty Name;
$Members = @{};
foreach ($Property in $Properties) {
switch ($Schema.items.anyOf.properties.$Property.type) {
switch ($SchemaDocument.items.anyOf.properties.$Property.type) {
'object' {
$Members.Add($Property, (New-Object -TypeName psobject -Property @{}))
}
Expand All @@ -103,16 +103,16 @@ function Get-Property {
[OutputType([Object])]
param (
[Parameter(ValueFromPipeline)]
[object]$Schema,
[object]$SchemaDocument,
[string]$Name
)

process {
if ($Name) {
$Schema.properties.$Name;
$SchemaDocument.properties.$Name;
}
else {
$Schema.properties;
$SchemaDocument.properties;
}
}
}