File tree Expand file tree Collapse file tree 1 file changed +23
-16
lines changed Expand file tree Collapse file tree 1 file changed +23
-16
lines changed Original file line number Diff line number Diff line change 1
1
function Get-Document {
2
+ [CmdletBinding (
3
+ HelpURI = ' https://github.com/SchemaModule/PowerShell/blob/master/docs/Get-SchemaDocument.md#get-schemadocument' ,
4
+ PositionalBinding = $true )]
5
+ [OutputType ([Object ])]
2
6
param (
7
+ [Parameter (ValueFromPipeline )]
3
8
[string ]$Path
4
9
)
5
10
6
- try {
7
- $ErrorActionPreference = ' Stop' ;
8
- $Error.Clear ();
11
+ process {
12
+ try {
13
+ $ErrorActionPreference = ' Stop' ;
14
+ $Error.Clear ();
9
15
10
- $Schema = [System.UriBuilder ]::new($Path );
16
+ $Schema = [System.UriBuilder ]::new($Path );
11
17
12
- switch ($Schema.Scheme ) {
13
- ' file' {
14
- Get-Content - Path $Path | ConvertFrom-Json
15
- }
16
- ' https' {
17
- Invoke-WebRequest - UseBasicParsing - Uri $Path | Select-Object - ExpandProperty Content | ConvertFrom-Json
18
- }
19
- ' http' {
20
- Invoke-WebRequest - UseBasicParsing - Uri $Path | Select-Object - ExpandProperty Content | ConvertFrom-Json
18
+ switch ($Schema.Scheme ) {
19
+ ' file' {
20
+ Get-Content - Path $Path | ConvertFrom-Json ;
21
+ }
22
+ ' https' {
23
+ Invoke-WebRequest - UseBasicParsing - Uri $Path | Select-Object - ExpandProperty Content | ConvertFrom-Json ;
24
+ }
25
+ ' http' {
26
+ Invoke-WebRequest - UseBasicParsing - Uri $Path | Select-Object - ExpandProperty Content | ConvertFrom-Json ;
27
+ }
21
28
}
22
29
}
23
- }
24
- catch {
25
- throw $_
30
+ catch {
31
+ throw $_ ;
32
+ }
26
33
}
27
34
}
28
35
function Get-Object {
You can’t perform that action at this time.
0 commit comments