Skip to content

Commit e3bbae7

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

Some content is hidden

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

46 files changed

+853
-718
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 & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,12 @@ require (
99
)
1010

1111
require (
12+
github.com/stretchr/testify v1.11.1
1213
golang.org/x/crypto v0.46.0 // indirect
1314
golang.org/x/sys v0.39.0 // indirect
1415
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
16+
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
17+
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
1518
)
1619

1720
// Local module replacements for Docker builds

gateway/gateway-builder/go.sum

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
1+
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
2+
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
13
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
24
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
35
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
46
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
57
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
68
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
79
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
10+
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
11+
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
812
github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ=
913
github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc=
14+
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
15+
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
1016
golang.org/x/crypto v0.46.0 h1:cKRW/pmt1pKAfetfu+RCEvjvZkA9RimPbh7bhFjGVBU=
1117
golang.org/x/crypto v0.46.0/go.mod h1:Evb/oLKmMraqjZ2iQTwDwvCtJkczlDuTmdJXoZVzqU0=
1218
golang.org/x/mod v0.30.0 h1:fDEXFVZ/fmCKProc/yAXXUijritrDzahmwwefnjoPFk=

0 commit comments

Comments
 (0)