Skip to content

Documentation Update #18

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 6 commits into from
Sep 9, 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
24 changes: 16 additions & 8 deletions docs/Get-SchemaArray.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ schema: 2.0.0
# Get-SchemaArray

## SYNOPSIS
{{ Fill in the Synopsis }}
This function returns the object from an array within the Json Schema.

## SYNTAX

Expand All @@ -17,21 +17,28 @@ Get-SchemaArray [[-SchemaDocument] <Object>] [<CommonParameters>]
```

## DESCRIPTION
{{ Fill in the Description }}
This function returns the object from an array within the Json Schema. This function expands the array and returns a
PowerShell representation of the object.

## EXAMPLES

### Example 1
```powershell
PS C:\> {{ Add example code here }}
PS C:\> $SchemaDocument = 'https://gist.githubusercontent.com/jeffpatton1971/c2d3ee98a37766a2784ccd626b9b8ca2/raw/f2a92166f52e067542964216a7618b8d2c408489/array.json' |Get-SchemaDocument
PS C:\> $SchemaDocument.properties.products |Get-SchemaArray

price dimensions tags name
----- ---------- ---- ----
0 {}
```

{{ Add example description here }}
This example reads in a Json schema from the internet and then passes in a specific array item within the schema.

## PARAMETERS

### -SchemaDocument
{{ Fill SchemaDocument Description }}
This should be the output of Get-SchemaDocument. For simple JSON schema's this could be passed along the pipeline
to this function.

```yaml
Type: Object
Expand All @@ -49,13 +56,14 @@ Accept wildcard characters: False
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

### System.Object
This should always be the output of the Get-SchemaDocument function.

## OUTPUTS

### System.Array
### System.Object
A PowerShell representation of the referenced schema

## NOTES

## RELATED LINKS
[Get-SchemaDocument](https://github.com/SchemaModule/PowerShell/blob/master/docs/Get-SchemaDocument.md#get-schemadocument)
44 changes: 37 additions & 7 deletions docs/Get-SchemaDocument.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ schema: 2.0.0
# Get-SchemaDocument

## SYNOPSIS
{{ Fill in the Synopsis }}
This function will return a PowerShell object of the input Schema.

## SYNTAX

Expand All @@ -17,21 +17,50 @@ Get-SchemaDocument [[-Path] <String>] [<CommonParameters>]
```

## DESCRIPTION
{{ Fill in the Description }}
This function will return a PowerShell object of the input Schema. This will help in building PowerShell objects
that can be defined by a JSON schema. This allows a script to dynamically build objects based on a well-defined
JSON schema.

## EXAMPLES

### Example 1
```powershell
PS C:\> {{ Add example code here }}
PS C:\> 'https://gist.githubusercontent.com/jeffpatton1971/c2d3ee98a37766a2784ccd626b9b8ca2/raw/a112c9119cce507c2b4e115c35afc6c26f63ffc7/schema.json' |Get-SchemaDocument


$schema : http://json-schema.org/draft-07/schema
$id : http://example.com/root.json
type : object
title : The Root Schema
description : The root schema is the schema that comprises the entire JSON document.
default :
required : {checked, dimensions, id, name...}
properties : @{checked=; dimensions=; id=; name=; price=; tags=}
```

This example demonstrates passing a URL along the pipeline to the function.

### Example 2
```powershell
PS C:\> Get-SchemaDocument -Path D:\CODE\JSON\schema.json


$schema : http://json-schema.org/draft-07/schema
$id : http://example.com/root.json
type : object
title : The Root Schema
description : The root schema is the schema that comprises the entire JSON document.
default :
required : {checked, dimensions, id, name...}
properties : @{checked=; dimensions=; id=; name=; price=; tags=}
```

{{ Add example description here }}
This example passes a json schema file into the function.

## PARAMETERS

### -Path
{{ Fill Path Description }}
This can be a filepath or URL, the function does light validation on the input.

```yaml
Type: String
Expand All @@ -49,13 +78,14 @@ Accept wildcard characters: False
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

### System.String
A local or remote Json Schema file as defined by json-schema.org

## OUTPUTS

### System.Object
A PowerShell object representing the corresponding Json Schema

## NOTES

## RELATED LINKS
[https://json-schema.org/](Json Schema Organization)
32 changes: 25 additions & 7 deletions docs/Get-SchemaObject.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ schema: 2.0.0
# Get-SchemaObject

## SYNOPSIS
{{ Fill in the Synopsis }}
This function returns an object from the Json Schema.

## SYNTAX

Expand All @@ -17,21 +17,38 @@ Get-SchemaObject [[-SchemaDocument] <Object>] [<CommonParameters>]
```

## DESCRIPTION
{{ Fill in the Description }}
This function returns an object from the Json Schema. By passing in a specific data structure and get back a
PowerShell representation of the structure.

## EXAMPLES

### Example 1
```powershell
PS C:\> {{ Add example code here }}
PS C:\> Get-SchemaObject -SchemaDocument $SchemaDocument

price dimensions tags name
----- ---------- ---- ----
0 {}
```

This example shows how to pass in an object to the function.

### Example 2
```powershell
PS C:\> 'https://gist.githubusercontent.com/jeffpatton1971/c2d3ee98a37766a2784ccd626b9b8ca2/raw/a112c9119cce507c2b4e115c35afc6c26f63ffc7/schema.json' |Get-SchemaDocument |Get-SchemaObject

price dimensions tags name
----- ---------- ---- ----
0 {}
```

{{ Add example description here }}
A slightly more complex example, showing the ability to pass the schema along the pipeline to other functions.

## PARAMETERS

### -SchemaDocument
{{ Fill SchemaDocument Description }}
This should be the output of Get-SchemaDocument. For simple JSON schema's this could be passed along the pipeline
to this function.

```yaml
Type: Object
Expand All @@ -49,13 +66,14 @@ Accept wildcard characters: False
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

### System.Object
This should always be the output of the Get-SchemaDocument function.

## OUTPUTS

### System.Object
A PowerShell representation of the referenced schema

## NOTES

## RELATED LINKS
[Get-SchemaDocument](https://github.com/SchemaModule/PowerShell/blob/master/docs/Get-SchemaDocument.md#get-schemadocument)
46 changes: 38 additions & 8 deletions docs/Get-SchemaProperty.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ schema: 2.0.0
# Get-SchemaProperty

## SYNOPSIS
{{ Fill in the Synopsis }}
This function returns one ore more properties from a Json Schema object.

## SYNTAX

Expand All @@ -17,21 +17,49 @@ Get-SchemaProperty [[-SchemaDocument] <Object>] [[-Name] <String>] [<CommonParam
```

## DESCRIPTION
{{ Fill in the Description }}
This function returns one ore more properties from a Json Schema object. This will allow you to view the detailed
information of a given property from the Schema.

## EXAMPLES

### Example 1
```powershell
PS C:\> {{ Add example code here }}
PS C:\> $SchemaDocument.properties.products.items.anyOf |Get-SchemaProperty


checked : @{$id=#/properties/products/items/anyOf/0/properties/checked; type=boolean; title=The checked schema; description=An explanation about the purpose of this instance.; default=False; examples=System.Object[]}
dimensions : @{$id=#/properties/products/items/anyOf/0/properties/dimensions; type=object; title=The dimensions schema; description=An explanation about the purpose of this instance.; default=; examples=System.Object[]; required=System.Object[]; properties=;
additionalProperties=True}
id : @{$id=#/properties/products/items/anyOf/0/properties/id; type=integer; title=The id schema; description=An explanation about the purpose of this instance.; default=0; examples=System.Object[]}
name : @{$id=#/properties/products/items/anyOf/0/properties/name; type=string; title=The name schema; description=An explanation about the purpose of this instance.; default=; examples=System.Object[]}
price : @{$id=#/properties/products/items/anyOf/0/properties/price; type=number; title=The price schema; description=An explanation about the purpose of this instance.; default=0.0; examples=System.Object[]}
tags : @{$id=#/properties/products/items/anyOf/0/properties/tags; type=array; title=The tags schema; description=An explanation about the purpose of this instance.; default=System.Object[]; examples=System.Object[]; additionalItems=True; items=}
```

This example passes the schema object along the pipeline and returns all properties.

### Example 2
```powershell
PS C:\> Get-SchemaProperty -SchemaDocument $SchemaDocument.properties.products.items.anyOf -Name dimensions


$id : #/properties/products/items/anyOf/0/properties/dimensions
type : object
title : The dimensions schema
description : An explanation about the purpose of this instance.
default :
examples : {@{width=5; height=10}}
required : {width, height}
properties : @{width=; height=}
additionalProperties : True
```

{{ Add example description here }}
This example passes the Schema into the function and references a specific named property to return.

## PARAMETERS

### -Name
{{ Fill Name Description }}
The name of a property to return

```yaml
Type: String
Expand All @@ -46,7 +74,8 @@ Accept wildcard characters: False
```

### -SchemaDocument
{{ Fill SchemaDocument Description }}
This should be the output of Get-SchemaDocument. For simple JSON schema's this could be passed along the pipeline
to this function.

```yaml
Type: Object
Expand All @@ -64,13 +93,14 @@ Accept wildcard characters: False
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

### System.Object
This should always be the output of the Get-SchemaDocument function.

## OUTPUTS

### System.Object
A PowerShell representation of the referenced schema

## NOTES

## RELATED LINKS
[Get-SchemaDocument](https://github.com/SchemaModule/PowerShell/blob/master/docs/Get-SchemaDocument.md#get-schemadocument)
Loading