Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Tieske committed Feb 15, 2024
1 parent 2360fd5 commit df4de54
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions openapi2kong/openapi2kong_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,34 @@ func Test_Openapi2kong_InsoCompat(t *testing.T) {
}
}
}

func Test_Openapi2kong_pathParamLength(t *testing.T) {
testDataString := `
openapi: 3.0.3
info:
title: Path parameter test
version: v1
servers:
- url: "https://example.com"
paths:
/demo/{something-very-long-that-is-way-beyond-the-32-limit}/:
get:
operationId: opsid
parameters:
- in: path
name: something-very-long-that-is-way-beyond-the-32-limit
required: true
schema:
type: string
responses:
"200":
description: OK
`
_, err := Convert([]byte(testDataString), O2kOptions{})
if err == nil {
t.Error("Expected error, but got none")
} else {
assert.Contains(t, err.Error(), "path-parameter name exceeds 32 characters")
}
}

0 comments on commit df4de54

Please sign in to comment.