Skip to content

Commit

Permalink
Merge 0735405 into 43e795b
Browse files Browse the repository at this point in the history
  • Loading branch information
Badgerati committed Jun 25, 2020
2 parents 43e795b + 0735405 commit e902616
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 17 deletions.
8 changes: 8 additions & 0 deletions docs/release-notes.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Release Notes

## v1.8.1

```plain
### Bugs
* #578: Fixes OpenAPI functions with rogue "=" on returning a value
* #581: Fixes large messages being sent via web sockets
```

## v1.8.0

```plain
Expand Down
6 changes: 5 additions & 1 deletion examples/web-rest-openapi-shared.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ Start-PodeServer {
))
}

New-PodeOAIntProperty -Name 'userId' -Required |
ConvertTo-PodeOAParameter -In Path |
Add-PodeOAComponentParameter -Name 'UserId'


Get-PodeAuthMiddleware -Name 'Validate' -Sessionless | Add-PodeMiddleware -Name 'AuthMiddleware' -Route '/api/*'
Set-PodeOAGlobalAuth -Name 'Validate'
Expand All @@ -55,7 +59,7 @@ Start-PodeServer {
} -PassThru |
Set-PodeOARouteInfo -Summary 'A cool summary' -Tags 'Users' -PassThru |
Set-PodeOARequest -Parameters @(
(New-PodeOAIntProperty -Name 'userId' -Required | ConvertTo-PodeOAParameter -In Path)
(ConvertTo-PodeOAParameter -Reference 'UserId')
) -PassThru |
Add-PodeOAResponse -StatusCode 200 -Reference 'OK'

Expand Down
13 changes: 1 addition & 12 deletions src/Private/Context.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -237,18 +237,7 @@ function New-PodeContext
$ctx.Server.Sessions = @{}

# swagger and openapi
$ctx.Server.OpenAPI = @{
Path = $null
Title = $null
components = @{
schemas = @{}
responses = @{}
securitySchemas = @{}
requestBodies = @{}
parameters = @{}
}
security = @()
}
$ctx.Server.OpenAPI = Get-PodeOABaseObject

# server metrics
$ctx.Metrics = @{
Expand Down
16 changes: 16 additions & 0 deletions src/Private/OpenApi.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -342,4 +342,20 @@ function ConvertTo-PodeOAPropertyFromCmdletParameter
}

New-PodeOAStringProperty -Name $Parameter.Name
}

function Get-PodeOABaseObject
{
return @{
Path = $null
Title = $null
components = @{
schemas = @{}
responses = @{}
securitySchemas = @{}
requestBodies = @{}
parameters = @{}
}
security = @()
}
}
2 changes: 1 addition & 1 deletion src/Private/Server.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ function Restart-PodeInternalServer
$PodeContext.Server.Endpoints = @()

# clear openapi
$PodeContext.Server.OpenAPI.Clear()
$PodeContext.Server.OpenAPI = Get-PodeOABaseObject

# clear the sockets
$PodeContext.Server.Sockets.Listeners = @()
Expand Down
10 changes: 10 additions & 0 deletions src/Private/SignalServer.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,19 @@ function Start-PodeSignalServer
}
elseif ($payload.Length -le [uint16]::MaxValue) {
$buffer += [byte]([byte]0x00 -bor [byte]126)
$buffer += [byte](($payload.Length -shr [byte]8) -band [byte]255)
$buffer += [byte]($payload.Length -band [byte]255)
}
else {
$buffer += [byte]([byte]0x00 -bor [byte]127)
$buffer += [byte](($payload.Length -shr [byte]56) -band [byte]255)
$buffer += [byte](($payload.Length -shr [byte]48) -band [byte]255)
$buffer += [byte](($payload.Length -shr [byte]40) -band [byte]255)
$buffer += [byte](($payload.Length -shr [byte]32) -band [byte]255)
$buffer += [byte](($payload.Length -shr [byte]24) -band [byte]255)
$buffer += [byte](($payload.Length -shr [byte]16) -band [byte]255)
$buffer += [byte](($payload.Length -shr [byte]8) -band [byte]255)
$buffer += [byte]($payload.Length -band [byte]255)
}

$buffer += $payload
Expand Down
6 changes: 3 additions & 3 deletions src/Public/OpenApi.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ function New-PodeOARequestBody
throw "The OpenApi component request body doesn't exist: $($Reference)"
}

return = @{
return @{
'$ref' = "#/components/requestBodies/$($Reference)"
}
}
Expand Down Expand Up @@ -700,7 +700,7 @@ function Add-PodeOAComponentParameter
$Name = $Parameter.name
}

$PodeContext.Server.OpenAPI.components.responses[$Name] = $Parameter
$PodeContext.Server.OpenAPI.components.parameters[$Name] = $Parameter
}

<#
Expand Down Expand Up @@ -1252,7 +1252,7 @@ function ConvertTo-PodeOAParameter
throw "The OpenApi component request parameter doesn't exist: $($Reference)"
}

return = @{
return @{
'$ref' = "#/components/parameters/$($Reference)"
}
}
Expand Down

0 comments on commit e902616

Please sign in to comment.