Skip to content

Commit c855d29

Browse files
committed
Modify to reject full semver and accept only major policy version
1 parent aba3e07 commit c855d29

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+861
-720
lines changed

.github/workflows/operator-integration-test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -974,7 +974,7 @@ jobs:
974974
url: http://httpbin.default.svc.cluster.local:80
975975
policies:
976976
- name: jwt-auth
977-
version: v0.1.2
977+
version: v0
978978
params:
979979
issuers:
980980
- MockKeyManager
@@ -1052,7 +1052,7 @@ jobs:
10521052
url: http://httpbin.default.svc.cluster.local:80
10531053
policies:
10541054
- name: jwt-auth
1055-
version: v0.1.2
1055+
version: v0
10561056
params:
10571057
issuers:
10581058
- DummyKeyManager

concepts/api-yaml-specification.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ data:
5959
| Field | Type | Required | Description |
6060
|-------|------|----------|-------------|
6161
| `name` | string | Yes | Policy name (e.g., `apiKey`, `jwt`, `rateLimit`) |
62+
| `version` | string | Yes | Policy version; must be **major-only** (e.g., `v0`, `v1`). Full semantic versions (e.g., `v1.0.0`) are not allowed. |
6263
| `params` | object | No | Policy-specific parameters |
6364

6465
---

gateway/examples/basic-ratelimit-demo-api.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ spec:
3434
# API-level rate limiting: Apply to all operations
3535
policies:
3636
- name: basic-ratelimit
37-
version: v0.1.1
37+
version: v0
3838
params:
3939
limits:
4040
- limit: 100
@@ -55,7 +55,7 @@ spec:
5555
path: /products/search
5656
policies:
5757
- name: basic-ratelimit
58-
version: v0.1.1
58+
version: v0
5959
params:
6060
limits:
6161
- limit: 200

gateway/examples/llm-proxy.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ spec:
2727
provider: wso2-openai-provider
2828
policies:
2929
- name: semanticPromptGuard
30-
version: v1.0.0
30+
version: v1
3131
paths:
3232
- path: /chat/completions
3333
methods: [ POST ]
@@ -53,7 +53,7 @@ spec:
5353
"If you don't know the answer, just say that you don't know. Don't try to make up an answer."
5454
]
5555
- name: multiModelRouting
56-
version: v1.0.0
56+
version: v1
5757
paths:
5858
- path: /chat/completions
5959
methods: [ POST ]
@@ -62,7 +62,7 @@ spec:
6262
- gpt-5.1
6363
- gpt-4.5
6464
- name: multiProviderRouting
65-
version: v1.0.0
65+
version: v1
6666
paths:
6767
- path: /chat/completions
6868
methods: [ POST ]
@@ -77,7 +77,7 @@ spec:
7777
- name: wso2-azure-provider
7878
version: v1.0
7979
- name: oAuth
80-
version: v1.0.0
80+
version: v1
8181
paths:
8282
- path: /
8383
methods: [ "*" ]

gateway/examples/petstore-api.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,14 @@ spec:
2929
url: http://petstore.swagger.io/v2
3030
policies:
3131
- name: apiKeyValidation
32-
version: v1.0.0
32+
version: v1
3333
executionCondition: "request.metadata[authenticated] != true"
3434
params: # any object
3535
header: "X-API-Key"
3636
optional: false
3737
mandatory: true
3838
- name: setHeaders
39-
version: v1.0.0
39+
version: v1
4040
params: # any object
4141
requestHeaders:
4242
- X-Request-Source: WSO2 API Manager test
@@ -47,7 +47,7 @@ spec:
4747
path: /pet/{petId}
4848
policies:
4949
- name: apiKeyValidation
50-
version: v1.0.0
50+
version: v1
5151
executionCondition: "request.metadata[authenticated] != true"
5252
params: # any object
5353
header: "X-API-Key"

gateway/examples/ratelimit-demo-api.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ spec:
3434
# API-level rate limiting: Apply to all operations
3535
policies:
3636
- name: advanced-ratelimit
37-
version: v0.1.3
37+
version: v0
3838
params:
3939
# Default cost for all operations (can be overridden per operation)
4040
cost: 1
@@ -72,7 +72,7 @@ spec:
7272
path: /products/search
7373
policies:
7474
- name: advanced-ratelimit
75-
version: v0.1.3
75+
version: v0
7676
params:
7777
cost: 5 # Search operations consume more resources
7878
limits:
@@ -91,7 +91,7 @@ spec:
9191
path: /reports/generate
9292
policies:
9393
- name: advanced-ratelimit
94-
version: v0.1.3
94+
version: v0
9595
params:
9696
cost: 10 # Report generation is expensive
9797
limits:
@@ -114,7 +114,7 @@ spec:
114114
path: /public/products
115115
policies:
116116
- name: advanced-ratelimit
117-
version: v0.1.3
117+
version: v0
118118
params:
119119
cost: 1
120120
limits:
@@ -133,7 +133,7 @@ spec:
133133
path: /orders
134134
policies:
135135
- name: advanced-ratelimit
136-
version: v0.1.3
136+
version: v0
137137
params:
138138
cost: 1
139139
limits:
@@ -157,7 +157,7 @@ spec:
157157
path: /inventory/check
158158
policies:
159159
- name: advanced-ratelimit
160-
version: v0.1.3
160+
version: v0
161161
params:
162162
cost: 1
163163
limits:
@@ -181,7 +181,7 @@ spec:
181181
path: /inventory/apilevel1
182182
policies:
183183
- name: advanced-ratelimit
184-
version: v0.1.3
184+
version: v0
185185
params:
186186
cost: 1
187187
limits:
@@ -193,7 +193,7 @@ spec:
193193
path: /inventory/apilevel2
194194
policies:
195195
- name: advanced-ratelimit
196-
version: v0.1.3
196+
version: v0
197197
params:
198198
cost: 1
199199
limits:

gateway/examples/self-signed-secure-api.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ spec:
2929
# url: http://httpbin.org/anything
3030
policies:
3131
- name: jwt-auth
32-
version: v0.1.1
32+
version: v0
3333
params:
3434
issuers:
3535
- WSO2KeyManager1

gateway/examples/weather-api.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ spec:
2929
url: http://sample-backend:5000/api/v2
3030
policies:
3131
- name: modify-headers
32-
version: v0.1.1
32+
version: v0
3333
params:
3434
requestHeaders:
3535
- action: SET
@@ -47,7 +47,7 @@ spec:
4747
path: /{country_code}/{city}
4848
policies:
4949
- name: modify-headers
50-
version: v0.1.1
50+
version: v0
5151
params:
5252
requestHeaders:
5353
- action: SET
@@ -58,7 +58,7 @@ spec:
5858
name: operation-level-res-header
5959
value: world
6060
- name: basic-ratelimit
61-
version: v0.1.2
61+
version: v0
6262
params:
6363
limits:
6464
- limit: 5
@@ -69,7 +69,7 @@ spec:
6969
path: /alerts/active
7070
policies:
7171
- name: respond
72-
version: v0.1.0
72+
version: v0
7373
params:
7474
statusCode: 201
7575
body: '{"message": "Active weather alert created successfully."}'

gateway/gateway-builder/go.mod

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@ require (
1010
)
1111

1212
require (
13-
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
14-
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
13+
github.com/stretchr/testify v1.11.1
1514
golang.org/x/crypto v0.46.0 // indirect
1615
golang.org/x/sys v0.39.0 // indirect
1716
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
17+
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
18+
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
1819
)
1920

2021
// Local module replacements for Docker builds

gateway/gateway-controller/api/openapi.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,13 @@ paths:
8282
- url: http://petstore.swagger.io/v2
8383
policies:
8484
- name: apiKeyValidation
85-
version: v1.0.0
85+
version: v1
8686
executionCondition: "request.metadata[authenticated] != true"
8787
params:
8888
header: X-API-Key
8989
mandatory: true
9090
- name: setHeaders
91-
version: v1.0.0
91+
version: v1
9292
params:
9393
requestHeaders:
9494
- X-Request-Source: WSO2 API Manager
@@ -99,7 +99,7 @@ paths:
9999
path: /pet/{petId}
100100
policies:
101101
- name: apiKeyValidation
102-
version: v1.0.0
102+
version: v1
103103
executionCondition: "request.metadata[authenticated] != true"
104104
params:
105105
header: X-API-Key
@@ -1978,11 +1978,11 @@ components:
19781978
version:
19791979
type: string
19801980
description: >
1981-
Version of the policy. Accepts either a full semantic version
1982-
(e.g., v1.0.0) or a major-only version (e.g., v1). When a major-only
1983-
version is provided, the Gateway Controller resolves it to the single
1984-
matching full version that is installed in the gateway image.
1985-
pattern: '^(v\d+|v\d+\.\d+\.\d+)$'
1981+
Version of the policy. Only major-only version is allowed (e.g., v0, v1).
1982+
Full semantic version (e.g., v1.0.0) is not accepted and will be rejected.
1983+
The Gateway Controller resolves the major version to the single matching
1984+
full version installed in the gateway image.
1985+
pattern: '^v\d+$'
19861986
example: v1
19871987
executionCondition:
19881988
type: string

0 commit comments

Comments
 (0)