Skip to content

Commit be218cc

Browse files
Merge pull request #18 from SchemaModule/issue-15
Documentation Update
2 parents b231bf8 + 5b79d16 commit be218cc

File tree

6 files changed

+554
-30
lines changed

6 files changed

+554
-30
lines changed

docs/Get-SchemaArray.md

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ schema: 2.0.0
88
# Get-SchemaArray
99

1010
## SYNOPSIS
11-
{{ Fill in the Synopsis }}
11+
This function returns the object from an array within the Json Schema.
1212

1313
## SYNTAX
1414

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

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

2223
## EXAMPLES
2324

2425
### Example 1
2526
```powershell
26-
PS C:\> {{ Add example code here }}
27+
PS C:\> $SchemaDocument = 'https://gist.githubusercontent.com/jeffpatton1971/c2d3ee98a37766a2784ccd626b9b8ca2/raw/f2a92166f52e067542964216a7618b8d2c408489/array.json' |Get-SchemaDocument
28+
PS C:\> $SchemaDocument.properties.products |Get-SchemaArray
29+
30+
price dimensions tags name
31+
----- ---------- ---- ----
32+
0 {}
2733
```
2834

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

3137
## PARAMETERS
3238

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

3643
```yaml
3744
Type: Object
@@ -49,13 +56,14 @@ Accept wildcard characters: False
4956
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).
5057
5158
## INPUTS
52-
5359
### System.Object
60+
This should always be the output of the Get-SchemaDocument function.
5461
5562
## OUTPUTS
56-
57-
### System.Array
63+
### System.Object
64+
A PowerShell representation of the referenced schema
5865
5966
## NOTES
6067
6168
## RELATED LINKS
69+
[Get-SchemaDocument](https://github.com/SchemaModule/PowerShell/blob/master/docs/Get-SchemaDocument.md#get-schemadocument)

docs/Get-SchemaDocument.md

Lines changed: 37 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ schema: 2.0.0
88
# Get-SchemaDocument
99

1010
## SYNOPSIS
11-
{{ Fill in the Synopsis }}
11+
This function will return a PowerShell object of the input Schema.
1212

1313
## SYNTAX
1414

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

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

2224
## EXAMPLES
2325

2426
### Example 1
2527
```powershell
26-
PS C:\> {{ Add example code here }}
28+
PS C:\> 'https://gist.githubusercontent.com/jeffpatton1971/c2d3ee98a37766a2784ccd626b9b8ca2/raw/a112c9119cce507c2b4e115c35afc6c26f63ffc7/schema.json' |Get-SchemaDocument
29+
30+
31+
$schema : http://json-schema.org/draft-07/schema
32+
$id : http://example.com/root.json
33+
type : object
34+
title : The Root Schema
35+
description : The root schema is the schema that comprises the entire JSON document.
36+
default :
37+
required : {checked, dimensions, id, name...}
38+
properties : @{checked=; dimensions=; id=; name=; price=; tags=}
39+
```
40+
41+
This example demonstrates passing a URL along the pipeline to the function.
42+
43+
### Example 2
44+
```powershell
45+
PS C:\> Get-SchemaDocument -Path D:\CODE\JSON\schema.json
46+
47+
48+
$schema : http://json-schema.org/draft-07/schema
49+
$id : http://example.com/root.json
50+
type : object
51+
title : The Root Schema
52+
description : The root schema is the schema that comprises the entire JSON document.
53+
default :
54+
required : {checked, dimensions, id, name...}
55+
properties : @{checked=; dimensions=; id=; name=; price=; tags=}
2756
```
2857

29-
{{ Add example description here }}
58+
This example passes a json schema file into the function.
3059

3160
## PARAMETERS
3261

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

3665
```yaml
3766
Type: String
@@ -49,13 +78,14 @@ Accept wildcard characters: False
4978
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).
5079
5180
## INPUTS
52-
5381
### System.String
82+
A local or remote Json Schema file as defined by json-schema.org
5483
5584
## OUTPUTS
56-
5785
### System.Object
86+
A PowerShell object representing the corresponding Json Schema
5887
5988
## NOTES
6089
6190
## RELATED LINKS
91+
[https://json-schema.org/](Json Schema Organization)

docs/Get-SchemaObject.md

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ schema: 2.0.0
88
# Get-SchemaObject
99

1010
## SYNOPSIS
11-
{{ Fill in the Synopsis }}
11+
This function returns an object from the Json Schema.
1212

1313
## SYNTAX
1414

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

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

2223
## EXAMPLES
2324

2425
### Example 1
2526
```powershell
26-
PS C:\> {{ Add example code here }}
27+
PS C:\> Get-SchemaObject -SchemaDocument $SchemaDocument
28+
29+
price dimensions tags name
30+
----- ---------- ---- ----
31+
0 {}
32+
```
33+
34+
This example shows how to pass in an object to the function.
35+
36+
### Example 2
37+
```powershell
38+
PS C:\> 'https://gist.githubusercontent.com/jeffpatton1971/c2d3ee98a37766a2784ccd626b9b8ca2/raw/a112c9119cce507c2b4e115c35afc6c26f63ffc7/schema.json' |Get-SchemaDocument |Get-SchemaObject
39+
40+
price dimensions tags name
41+
----- ---------- ---- ----
42+
0 {}
2743
```
2844

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

3147
## PARAMETERS
3248

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

3653
```yaml
3754
Type: Object
@@ -49,13 +66,14 @@ Accept wildcard characters: False
4966
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).
5067
5168
## INPUTS
52-
5369
### System.Object
70+
This should always be the output of the Get-SchemaDocument function.
5471
5572
## OUTPUTS
56-
5773
### System.Object
74+
A PowerShell representation of the referenced schema
5875
5976
## NOTES
6077
6178
## RELATED LINKS
79+
[Get-SchemaDocument](https://github.com/SchemaModule/PowerShell/blob/master/docs/Get-SchemaDocument.md#get-schemadocument)

docs/Get-SchemaProperty.md

Lines changed: 38 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ schema: 2.0.0
88
# Get-SchemaProperty
99

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

1313
## SYNTAX
1414

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

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

2223
## EXAMPLES
2324

2425
### Example 1
2526
```powershell
26-
PS C:\> {{ Add example code here }}
27+
PS C:\> $SchemaDocument.properties.products.items.anyOf |Get-SchemaProperty
28+
29+
30+
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[]}
31+
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=;
32+
additionalProperties=True}
33+
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[]}
34+
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[]}
35+
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[]}
36+
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=}
37+
```
38+
39+
This example passes the schema object along the pipeline and returns all properties.
40+
41+
### Example 2
42+
```powershell
43+
PS C:\> Get-SchemaProperty -SchemaDocument $SchemaDocument.properties.products.items.anyOf -Name dimensions
44+
45+
46+
$id : #/properties/products/items/anyOf/0/properties/dimensions
47+
type : object
48+
title : The dimensions schema
49+
description : An explanation about the purpose of this instance.
50+
default :
51+
examples : {@{width=5; height=10}}
52+
required : {width, height}
53+
properties : @{width=; height=}
54+
additionalProperties : True
2755
```
2856

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

3159
## PARAMETERS
3260

3361
### -Name
34-
{{ Fill Name Description }}
62+
The name of a property to return
3563

3664
```yaml
3765
Type: String
@@ -46,7 +74,8 @@ Accept wildcard characters: False
4674
```
4775
4876
### -SchemaDocument
49-
{{ Fill SchemaDocument Description }}
77+
This should be the output of Get-SchemaDocument. For simple JSON schema's this could be passed along the pipeline
78+
to this function.
5079
5180
```yaml
5281
Type: Object
@@ -64,13 +93,14 @@ Accept wildcard characters: False
6493
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).
6594
6695
## INPUTS
67-
6896
### System.Object
97+
This should always be the output of the Get-SchemaDocument function.
6998
7099
## OUTPUTS
71-
72100
### System.Object
101+
A PowerShell representation of the referenced schema
73102
74103
## NOTES
75104
76105
## RELATED LINKS
106+
[Get-SchemaDocument](https://github.com/SchemaModule/PowerShell/blob/master/docs/Get-SchemaDocument.md#get-schemadocument)

0 commit comments

Comments
 (0)