Skip to content
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

Validate non-null json #76

Merged
merged 3 commits into from
Jun 17, 2024
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
4 changes: 3 additions & 1 deletion BuildCustomFunctions.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,9 @@ Try {
$EndContent = @()
# Results logic - If the output model is undefined in the swagger spec
$ResultsLogic = If ($Command.OutputType -like "$ModuleName.Models.*ApplicationJson*") {
"($($ImportedModule.Name)\$($CommandName) -ErrorAction SilentlyContinue -errorVariable sdkError @PSBoundParameters).ToJsonString() | ConvertFrom-Json;"
@"
($($ImportedModule.Name)\$($CommandName) -ErrorAction SilentlyContinue -errorVariable sdkError @PSBoundParameters); if (-not [System.String]::IsNullOrEmpty(`$Result)) { `$Result = `$Result.ToJsonString() | ConvertFrom-Json };
"@
} Else {
"$($ImportedModule.Name)\$($CommandName) @PSBoundParameters -errorAction SilentlyContinue -errorVariable sdkError"
}
Expand Down
2 changes: 1 addition & 1 deletion Configs/JumpCloud.SDK.DirectoryInsights.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ input-file:
module-name: JumpCloud.SDK.DirectoryInsights
namespace: JumpCloud.SDK.DirectoryInsights
sample-generation: true
module-version: 0.0.31
module-version: 0.0.32
dll-name: JumpCloud.SDK.DirectoryInsights.private

directive:
Expand Down
2 changes: 1 addition & 1 deletion Configs/JumpCloud.SDK.V1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ input-file:
module-name: JumpCloud.SDK.V1
namespace: JumpCloud.SDK.V1
sample-generation: true
module-version: 0.0.43
module-version: 0.0.44
dll-name: JumpCloud.SDK.V1.private

directive:
Expand Down
2 changes: 1 addition & 1 deletion Configs/JumpCloud.SDK.V2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ input-file:
module-name: JumpCloud.SDK.V2
namespace: JumpCloud.SDK.V2
sample-generation: true
module-version: 0.0.47
module-version: 0.0.48
dll-name: JumpCloud.SDK.V2.private

directive:
Expand Down
30 changes: 30 additions & 0 deletions JumpCloud.SDK.DirectoryInsights.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,33 @@
## JumpCloud.SDK.DirectoryInsights-0.0.32
Release Date: June 17, 2024
#### RELEASE NOTES
```
This release includes an update to functions that return formatted json data.
```

#### BUG FIXES:
Functions that return formatted json data will now validate that the response is non-null before attempting to convert the response from Json. This resulted in an error for null responses in previous versions of the module. Get-JcSdkEvent should no longer throw an error if no results are returned.

#### Generated Changes:

<details>
<summary>Functions Added</summary>

No changes
</details>

<details>
<summary>Functions Modified</summary>

No changes
</details>

<details>
<summary>Functions Removed</summary>

No changes
</details>

## JumpCloud.SDK.DirectoryInsights-0.0.31
Release Date: June 06, 2024
#### RELEASE NOTES
Expand Down
29 changes: 29 additions & 0 deletions JumpCloud.SDK.V1.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,32 @@
## JumpCloud.SDK.V1-0.0.44
Release Date: June 17, 2024
#### RELEASE NOTES
```
This release includes an update to functions that return formatted json data.
```

#### BUG FIXES:
Functions that return formatted json data will now validate that the response is non-null before attempting to convert the response from Json. This resulted in an error for null responses in previous versions of the module.
#### Generated Changes:

<details>
<summary>Functions Added</summary>

No changes
</details>

<details>
<summary>Functions Modified</summary>

No changes
</details>

<details>
<summary>Functions Removed</summary>

No changes
</details>

## JumpCloud.SDK.V1-0.0.43
Release Date: June 06, 2024
#### RELEASE NOTES
Expand Down
29 changes: 29 additions & 0 deletions JumpCloud.SDK.V2.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,32 @@
## JumpCloud.SDK.V2-0.0.48
Release Date: June 17, 2024
#### RELEASE NOTES
```
This release includes an update to functions that return formatted json data.
```

#### BUG FIXES:
Functions that return formatted json data will now validate that the response is non-null before attempting to convert the response from Json. This resulted in an error for null responses in previous versions of the module.
#### Generated Changes:

<details>
<summary>Functions Added</summary>

No changes
</details>

<details>
<summary>Functions Modified</summary>

No changes
</details>

<details>
<summary>Functions Removed</summary>

No changes
</details>

## JumpCloud.SDK.V2-0.0.47
Release Date: June 06, 2024
#### RELEASE NOTES
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Version>0.0.31</Version>
<Version>0.0.32</Version>
<LangVersion>7.1</LangVersion>
<TargetFramework>netstandard2.0</TargetFramework>
<OutputType>Library</OutputType>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
<metadata>
<id>JumpCloud.SDK.DirectoryInsights</id>
<version>0.0.31</version>
<version>0.0.32</version>
<authors>JumpCloud</authors>
<owners>JumpCloud</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# Generated by: JumpCloud
#
# Generated on: 6/6/2024
# Generated on: 6/17/2024
#

@{
Expand All @@ -12,7 +12,7 @@
RootModule = './JumpCloud.SDK.DirectoryInsights.psm1'

# Version number of this module.
ModuleVersion = '0.0.31'
ModuleVersion = '0.0.32'

# Supported PSEditions
CompatiblePSEditions = 'Core', 'Desktop'
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@ protected async Task<HttpResponseMessage> AddAuthHeaders(HttpRequestMessage requ
request.Headers.Add("Accept", "application/json");
}
// If headers do not contain an "UserAgent" with the correct value fix it
if (request.Headers.UserAgent.ToString() != "JumpCloud_JumpCloud.PowerShell.SDK.DirectoryInsights/0.0.31")
if (request.Headers.UserAgent.ToString() != "JumpCloud_JumpCloud.PowerShell.SDK.DirectoryInsights/0.0.32")
{
request.Headers.UserAgent.Clear();
request.Headers.UserAgent.ParseAdd("JumpCloud_JumpCloud.PowerShell.SDK.DirectoryInsights/0.0.31");
request.Headers.UserAgent.ParseAdd("JumpCloud_JumpCloud.PowerShell.SDK.DirectoryInsights/0.0.32");
}
// // request.Headers.Add("Content-Type", "application/json");
System.Net.Http.HttpResponseMessage response = await next.SendAsync(request, callback);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ https://github.com/TheJumpCloud/jcapi-powershell/tree/master/SDKs/PowerShell/Jum
$resultCounter = 0
:retryLoop do {
$resultCounter++
$Result = (JumpCloud.SDK.DirectoryInsights.internal\Get-JcSdkInternalEvent -ErrorAction SilentlyContinue -errorVariable sdkError @PSBoundParameters).ToJsonString() | ConvertFrom-Json;
$Result = (JumpCloud.SDK.DirectoryInsights.internal\Get-JcSdkInternalEvent -ErrorAction SilentlyContinue -errorVariable sdkError @PSBoundParameters); if (-not [System.String]::IsNullOrEmpty($Result)) { $Result = $Result.ToJsonString() | ConvertFrom-Json };
If ($sdkError){
If ($resultCounter -eq $maxRetries){
throw $sdkError
Expand Down Expand Up @@ -272,7 +272,7 @@ https://github.com/TheJumpCloud/jcapi-powershell/tree/master/SDKs/PowerShell/Jum
$resultCounter = 0
:retryLoop do {
$resultCounter++
$Result = (JumpCloud.SDK.DirectoryInsights.internal\Get-JcSdkInternalEvent -ErrorAction SilentlyContinue -errorVariable sdkError @PSBoundParameters).ToJsonString() | ConvertFrom-Json;
$Result = (JumpCloud.SDK.DirectoryInsights.internal\Get-JcSdkInternalEvent -ErrorAction SilentlyContinue -errorVariable sdkError @PSBoundParameters); if (-not [System.String]::IsNullOrEmpty($Result)) { $Result = $Result.ToJsonString() | ConvertFrom-Json };
If ($sdkError){
If ($resultCounter -eq $maxRetries){
throw $sdkError
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ https://github.com/TheJumpCloud/jcapi-powershell/tree/master/SDKs/PowerShell/Jum
$resultCounter = 0
:retryLoop do {
$resultCounter++
$Result = (JumpCloud.SDK.DirectoryInsights.internal\Get-JcSdkInternalEventDistinct -ErrorAction SilentlyContinue -errorVariable sdkError @PSBoundParameters).ToJsonString() | ConvertFrom-Json;
$Result = (JumpCloud.SDK.DirectoryInsights.internal\Get-JcSdkInternalEventDistinct -ErrorAction SilentlyContinue -errorVariable sdkError @PSBoundParameters); if (-not [System.String]::IsNullOrEmpty($Result)) { $Result = $Result.ToJsonString() | ConvertFrom-Json };
If ($sdkError){
If ($resultCounter -eq $maxRetries){
throw $sdkError
Expand Down Expand Up @@ -232,7 +232,7 @@ https://github.com/TheJumpCloud/jcapi-powershell/tree/master/SDKs/PowerShell/Jum
$resultCounter = 0
:retryLoop do {
$resultCounter++
$Result = (JumpCloud.SDK.DirectoryInsights.internal\Get-JcSdkInternalEventDistinct -ErrorAction SilentlyContinue -errorVariable sdkError @PSBoundParameters).ToJsonString() | ConvertFrom-Json;
$Result = (JumpCloud.SDK.DirectoryInsights.internal\Get-JcSdkInternalEventDistinct -ErrorAction SilentlyContinue -errorVariable sdkError @PSBoundParameters); if (-not [System.String]::IsNullOrEmpty($Result)) { $Result = $Result.ToJsonString() | ConvertFrom-Json };
If ($sdkError){
If ($resultCounter -eq $maxRetries){
throw $sdkError
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ https://github.com/TheJumpCloud/jcapi-powershell/tree/master/SDKs/PowerShell/Jum
$resultCounter = 0
:retryLoop do {
$resultCounter++
$Result = (JumpCloud.SDK.DirectoryInsights.internal\Get-JcSdkInternalEventInterval -ErrorAction SilentlyContinue -errorVariable sdkError @PSBoundParameters).ToJsonString() | ConvertFrom-Json;
$Result = (JumpCloud.SDK.DirectoryInsights.internal\Get-JcSdkInternalEventInterval -ErrorAction SilentlyContinue -errorVariable sdkError @PSBoundParameters); if (-not [System.String]::IsNullOrEmpty($Result)) { $Result = $Result.ToJsonString() | ConvertFrom-Json };
If ($sdkError){
If ($resultCounter -eq $maxRetries){
throw $sdkError
Expand Down Expand Up @@ -255,7 +255,7 @@ https://github.com/TheJumpCloud/jcapi-powershell/tree/master/SDKs/PowerShell/Jum
$resultCounter = 0
:retryLoop do {
$resultCounter++
$Result = (JumpCloud.SDK.DirectoryInsights.internal\Get-JcSdkInternalEventInterval -ErrorAction SilentlyContinue -errorVariable sdkError @PSBoundParameters).ToJsonString() | ConvertFrom-Json;
$Result = (JumpCloud.SDK.DirectoryInsights.internal\Get-JcSdkInternalEventInterval -ErrorAction SilentlyContinue -errorVariable sdkError @PSBoundParameters); if (-not [System.String]::IsNullOrEmpty($Result)) { $Result = $Result.ToJsonString() | ConvertFrom-Json };
If ($sdkError){
If ($resultCounter -eq $maxRetries){
throw $sdkError
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ https://github.com/TheJumpCloud/jcapi-powershell/tree/master/SDKs/PowerShell/Jum
$resultCounter = 0
:retryLoop do {
$resultCounter++
$Result = (JumpCloud.SDK.DirectoryInsights.internal\Get-JcSdkInternalReport -ErrorAction SilentlyContinue -errorVariable sdkError @PSBoundParameters).ToJsonString() | ConvertFrom-Json;
$Result = (JumpCloud.SDK.DirectoryInsights.internal\Get-JcSdkInternalReport -ErrorAction SilentlyContinue -errorVariable sdkError @PSBoundParameters); if (-not [System.String]::IsNullOrEmpty($Result)) { $Result = $Result.ToJsonString() | ConvertFrom-Json };
If ($sdkError){
If ($resultCounter -eq $maxRetries){
throw $sdkError
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ https://github.com/TheJumpCloud/jcapi-powershell/tree/master/SDKs/PowerShell/Jum
$resultCounter = 0
:retryLoop do {
$resultCounter++
$Results = (JumpCloud.SDK.DirectoryInsights.internal\New-JcSdkInternalReport -ErrorAction SilentlyContinue -errorVariable sdkError @PSBoundParameters).ToJsonString() | ConvertFrom-Json;
$Results = (JumpCloud.SDK.DirectoryInsights.internal\New-JcSdkInternalReport -ErrorAction SilentlyContinue -errorVariable sdkError @PSBoundParameters); if (-not [System.String]::IsNullOrEmpty($Result)) { $Result = $Result.ToJsonString() | ConvertFrom-Json };
If ($sdkError){
If ($resultCounter -eq $maxRetries){
throw $sdkError
Expand Down
2 changes: 1 addition & 1 deletion SDKs/PowerShell/JumpCloud.SDK.V1/JumpCloud.SDK.V1.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Version>0.0.43</Version>
<Version>0.0.44</Version>
<LangVersion>7.1</LangVersion>
<TargetFramework>netstandard2.0</TargetFramework>
<OutputType>Library</OutputType>
Expand Down
40 changes: 40 additions & 0 deletions SDKs/PowerShell/JumpCloud.SDK.V1/JumpCloud.SDK.V1.format.ps1xml
Original file line number Diff line number Diff line change
Expand Up @@ -5427,6 +5427,9 @@
<TableColumnHeader>
<Label>PricePerUserSum</Label>
</TableColumnHeader>
<TableColumnHeader>
<Label>PurchaseChannel</Label>
</TableColumnHeader>
</TableHeaders>
<TableRowEntries>
<TableRowEntry>
Expand All @@ -5440,6 +5443,9 @@
<TableColumnItem>
<PropertyName>PricePerUserSum</PropertyName>
</TableColumnItem>
<TableColumnItem>
<PropertyName>PurchaseChannel</PropertyName>
</TableColumnItem>
</TableColumnItems>
</TableRowEntry>
</TableRowEntries>
Expand Down Expand Up @@ -8903,5 +8909,39 @@
</TableRowEntries>
</TableControl>
</View>
<View>
<Name>JumpCloud.SDK.V1.Models.UserreturnApiKeyHash</Name>
<ViewSelectedBy>
<TypeName>JumpCloud.SDK.V1.Models.UserreturnApiKeyHash</TypeName>
</ViewSelectedBy>
<TableControl>
<TableHeaders>
<TableColumnHeader>
<Label>CreatedAt</Label>
</TableColumnHeader>
<TableColumnHeader>
<Label>ExpireAt</Label>
</TableColumnHeader>
<TableColumnHeader>
<Label>Prefix</Label>
</TableColumnHeader>
</TableHeaders>
<TableRowEntries>
<TableRowEntry>
<TableColumnItems>
<TableColumnItem>
<PropertyName>CreatedAt</PropertyName>
</TableColumnItem>
<TableColumnItem>
<PropertyName>ExpireAt</PropertyName>
</TableColumnItem>
<TableColumnItem>
<PropertyName>Prefix</PropertyName>
</TableColumnItem>
</TableColumnItems>
</TableRowEntry>
</TableRowEntries>
</TableControl>
</View>
</ViewDefinitions>
</Configuration>
2 changes: 1 addition & 1 deletion SDKs/PowerShell/JumpCloud.SDK.V1/JumpCloud.SDK.V1.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
<metadata>
<id>JumpCloud.SDK.V1</id>
<version>0.0.43</version>
<version>0.0.44</version>
<authors>JumpCloud</authors>
<owners>JumpCloud</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
Expand Down
4 changes: 2 additions & 2 deletions SDKs/PowerShell/JumpCloud.SDK.V1/JumpCloud.SDK.V1.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# Generated by: JumpCloud
#
# Generated on: 6/6/2024
# Generated on: 6/17/2024
#

@{
Expand All @@ -12,7 +12,7 @@
RootModule = './JumpCloud.SDK.V1.psm1'

# Version number of this module.
ModuleVersion = '0.0.43'
ModuleVersion = '0.0.44'

# Supported PSEditions
CompatiblePSEditions = 'Core', 'Desktop'
Expand Down
20 changes: 20 additions & 0 deletions SDKs/PowerShell/JumpCloud.SDK.V1/custom/JumpCloud.SDK.V1.json
Original file line number Diff line number Diff line change
Expand Up @@ -2367,6 +2367,9 @@
},
"pricePerUserSum": {
"type": "integer"
},
"purchaseChannel": {
"type": "string"
}
},
"title": "OrganizationEntitlement",
Expand Down Expand Up @@ -4608,6 +4611,23 @@
"apiKeyAllowed": {
"type": "boolean"
},
"apiKeyHash": {
"additionalProperties": false,
"properties": {
"createdAt": {
"format": "date-time",
"type": "string"
},
"expireAt": {
"format": "date-time",
"type": "string"
},
"prefix": {
"type": "string"
}
},
"type": "object"
},
"apiKeySet": {
"type": "boolean"
},
Expand Down
Loading
Loading