Skip to content

Push v1.0.0 Module #21

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 42 commits into from
Sep 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
755b269
Added code to reference help documents and pipeline handling
jeffpatton1971 Sep 8, 2020
d6cb34c
Merge pull request #2 from SchemaModule/issue-1
jeffpatton1971 Sep 8, 2020
4339afd
Added code for externalhelp and pipelines
jeffpatton1971 Sep 8, 2020
4f99cb1
Added process block
jeffpatton1971 Sep 8, 2020
16fa647
Merge pull request #7 from SchemaModule/issue-3
jeffpatton1971 Sep 8, 2020
b58137f
Added externalhelp and pipeline code
jeffpatton1971 Sep 8, 2020
66d0c81
Added process block
jeffpatton1971 Sep 8, 2020
3740b2f
Merge pull request #8 from SchemaModule/issue-4
jeffpatton1971 Sep 8, 2020
e7d49d1
Added externalhelp and output type
jeffpatton1971 Sep 8, 2020
98cd36f
Added pipeline
jeffpatton1971 Sep 8, 2020
baddba1
Added process block
jeffpatton1971 Sep 8, 2020
c96ad70
Merge pull request #9 from SchemaModule/issue-5
jeffpatton1971 Sep 8, 2020
8d28822
Removed function
jeffpatton1971 Sep 8, 2020
1d978da
Removed function documentation
jeffpatton1971 Sep 8, 2020
761106e
Merge pull request #10 from SchemaModule/issue-6
jeffpatton1971 Sep 8, 2020
87d1629
Renamed Schema Parameter
jeffpatton1971 Sep 8, 2020
80b7abb
Updated initial help
jeffpatton1971 Sep 8, 2020
2aee4df
Merge pull request #12 from SchemaModule/issue-11
jeffpatton1971 Sep 8, 2020
0ac1d80
Added support for verbose
jeffpatton1971 Sep 9, 2020
e474bf6
Add support for verbose
jeffpatton1971 Sep 9, 2020
69d8351
Missed one
jeffpatton1971 Sep 9, 2020
951d00e
Added verbose support
jeffpatton1971 Sep 9, 2020
5ef9312
added verbose support
jeffpatton1971 Sep 9, 2020
b231bf8
Merge pull request #14 from SchemaModule/issue-13
jeffpatton1971 Sep 9, 2020
01a1a34
Added help
jeffpatton1971 Sep 9, 2020
170c122
added documentation
jeffpatton1971 Sep 9, 2020
5ecb98b
added documentation
jeffpatton1971 Sep 9, 2020
6ae93bd
added documentation
jeffpatton1971 Sep 9, 2020
6640de5
added external help documentation
jeffpatton1971 Sep 9, 2020
5b79d16
Added externalhelp reference
jeffpatton1971 Sep 9, 2020
be218cc
Merge pull request #18 from SchemaModule/issue-15
jeffpatton1971 Sep 9, 2020
699d6b5
added boolean
jeffpatton1971 Sep 9, 2020
a795a3d
Added integer
jeffpatton1971 Sep 9, 2020
f7e69c0
Merge pull request #19 from SchemaModule/issue-16
jeffpatton1971 Sep 9, 2020
71b9bc0
Updated all write-verbose schemadocument lines to use out-string so t…
jeffpatton1971 Sep 9, 2020
aa5f681
Merge pull request #20 from SchemaModule/issue-17
jeffpatton1971 Sep 9, 2020
a5f82e7
Several back-end updates
jeffpatton1971 Sep 9, 2020
96549ec
Updated readme with proper URL
jeffpatton1971 Sep 9, 2020
333e6c5
Another URL update for proper repo
jeffpatton1971 Sep 9, 2020
28f5bac
Moved changelog to proper location
jeffpatton1971 Sep 9, 2020
e48561d
updated readme
jeffpatton1971 Sep 9, 2020
3667309
Adding additional documentation to readme
jeffpatton1971 Sep 9, 2020
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
32 changes: 32 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Changelog
All changes to this module should be reflected in this document.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Unreleased

## [1.0.0] - 2020-09-09
### Added
- Updated documentation and external help
- CHNAGELOG added
- psakefile added

### Changed
- README
- Definition File updated with URLs and new version

### Fixed
- Missing some JSON data types, bool and int
- Write-Verbose acts different for arrays, so corrected the output

## [0.0.1] - 2020-09-08
### Added
- Repository Created
- Module manifest created
- Module file copied from outside repository
- Updated psd with defaultprefix and privatedata
- Added help and about help
- Converted functions to leverage the PowerShell Pipeline
- Removed New-RootDocument function
- Updated Schema param to be SchemaDocument
Binary file modified README.md
Binary file not shown.
34 changes: 23 additions & 11 deletions docs/Get-SchemaArray.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,37 @@ schema: 2.0.0
# Get-SchemaArray

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

## SYNTAX

```
Get-SchemaArray [[-Schema] <Object>]
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

### -Schema
{{ Fill Schema Description }}
### -SchemaDocument
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 @@ -41,17 +48,22 @@ Aliases:
Required: False
Position: 0
Default value: None
Accept pipeline input: False
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
```

## INPUTS
### 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).

### None
## 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)
54 changes: 44 additions & 10 deletions docs/Get-SchemaDocument.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,59 @@ schema: 2.0.0
# Get-SchemaDocument

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

## SYNTAX

```
Get-SchemaDocument [[-Path] <String>]
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 @@ -41,17 +70,22 @@ Aliases:
Required: False
Position: 0
Default value: None
Accept pipeline input: False
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
```

## INPUTS
### 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).

### None
## 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)
44 changes: 33 additions & 11 deletions docs/Get-SchemaObject.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,47 @@ schema: 2.0.0
# Get-SchemaObject

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

## SYNTAX

```
Get-SchemaObject [[-Schema] <Object>]
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

### -Schema
{{ Fill Schema Description }}
### -SchemaDocument
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 @@ -41,17 +58,22 @@ Aliases:
Required: False
Position: 0
Default value: None
Accept pipeline input: False
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
```

## INPUTS
### 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).

### None
## 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)
58 changes: 46 additions & 12 deletions docs/Get-SchemaProperty.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,58 @@ schema: 2.0.0
# Get-SchemaProperty

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

## SYNTAX

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

## 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 @@ -45,8 +73,9 @@ Accept pipeline input: False
Accept wildcard characters: False
```

### -Schema
{{ Fill Schema Description }}
### -SchemaDocument
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 @@ -56,17 +85,22 @@ Aliases:
Required: False
Position: 0
Default value: None
Accept pipeline input: False
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
```

## INPUTS
### 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).

### None
## 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