Skip to content

Commit

Permalink
use unsigned int of proper size
Browse files Browse the repository at this point in the history
  • Loading branch information
Tieske committed Nov 13, 2023
1 parent b29cf5a commit 6e04a85
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 8 deletions.
9 changes: 2 additions & 7 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,8 @@
"request": "launch",
"mode": "auto",
"program": "main.go",
"args": ["patch",
"-s",
"kong.yml",
"--selector",
"$..services[*]",
"--value",
"read_timeout:10000"
"args": [
"dump",
]
}
]
Expand Down
38 changes: 38 additions & 0 deletions openapi2kong/oas3_testfiles/04a-servers-upstream.expected.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"_format_version": "3.0",
"services": [
{
"host": "server2.com",
"id": "0907c4ab-d9e4-5d21-813b-c57a97eeaad9",
"name": "simple-api-overview",
"path": "/",
"plugins": [],
"port": 65000,
"protocol": "https",
"routes": [
{
"id": "eee036de-517e-59cf-a2e0-17b3adfa31b5",
"methods": [
"GET"
],
"name": "simple-api-overview_opsid",
"paths": [
"~/$"
],
"plugins": [],
"regex_priority": 200,
"strip_path": false,
"tags": [
"OAS3_import",
"OAS3file_04a-servers-upstream.yaml"
]
}
],
"tags": [
"OAS3_import",
"OAS3file_04a-servers-upstream.yaml"
]
}
],
"upstreams": []
}
17 changes: 17 additions & 0 deletions openapi2kong/oas3_testfiles/04a-servers-upstream.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# properly parses ports, see issue #104
# https://github.com/Kong/go-apiops/issues/104
openapi: '3.0.0'
info:
title: Simple API overview
version: v2
servers:
- url: https://server2.com:65000/
paths:
/:
get:
operationId: OpsId
summary: List API versions
responses:
'200':
description: |-
200 response
2 changes: 1 addition & 1 deletion openapi2kong/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ func CreateKongService(
if service["port"] == nil {
if targets[0].Port() != "" {
// port is provided, so parse it
parsedPort, err := strconv.ParseInt(targets[0].Port(), 10, 64)
parsedPort, err := strconv.ParseUint(targets[0].Port(), 10, 16)
if err != nil {
return nil, nil, err
}
Expand Down

0 comments on commit 6e04a85

Please sign in to comment.