Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev v2.8 community #55

Merged
merged 20 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/validate-json-schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ jobs:
- name: Ensure JSON Schemas are valid with respect to their metaschemas
run: jsonschema metaschema --ignore test --verbose
- name: Run JSON Schema unit tests
run: jsonschema test ./test/v2.7 --resolve v2.7
run: jsonschema test ./test/v2.8 --resolve v2.8
- name: Create a unified bundle
run: jsonschema bundle v2.7/_root.json --resolve v2.7 --without-id > v2.7/krakend.json
run: jsonschema bundle v2.8/_root.json --resolve v2.8 --without-id > v2.8/krakend.json
- name: Format bundle file
run: jsonschema fmt v2.7/krakend.json
run: jsonschema fmt v2.8/krakend.json
- uses: EndBug/add-and-commit@v9
with:
# The arguments for the `git add` command (see the paragraph below for more info)
# Default: '.'
add: 'v2.7/krakend.json'
add: 'v2.8/krakend.json'
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.PHONY: all build test

VERSION:="v2.7"
VERSION:="v2.8"
BIN:="docker run -it -v \"${PWD}:/workspace\" jsonschema"

all: build test
Expand Down
2 changes: 1 addition & 1 deletion e2e.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"title": "Schema validation for the latest version of KrakenD End to End testing. Consider sticking to the specific version you are using.",
"allOf": [
{
"$ref": "v2.7/e2e.json"
"$ref": "v2.8/e2e.json"
}
]
}
2 changes: 1 addition & 1 deletion flexible_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"title": "Schema validation for the latest version of Extended Flexible Configuration. Consider sticking to the specific version you are using.",
"allOf": [
{
"$ref": "v2.7/flexible_config.json"
"$ref": "v2.8/flexible_config.json"
}
]
}
2,248 changes: 2,248 additions & 0 deletions test/v2.8/all.json

Large diffs are not rendered by default.

87 changes: 87 additions & 0 deletions test/v2.8/backend.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
{
"description": "Backend object test",
"target": "https://www.krakend.io/schema/v2.8/backend.json",
"tests": [
{
"description": "Simple backend declaration with no host",
"data": {
"url_pattern": "/__debug/root"
},
"valid": true
},
{
"description": "Simple backend declaration with host",
"data": {
"url_pattern": "/__debug/root",
"host": [
"amqp://blah"
]
},
"valid": true
},
{
"description": "Simple backend declaration with empty string host",
"data": {
"url_pattern": "/__debug/root",
"host": [
""
]
},
"valid": false
},
{
"description": "Simple backend declaration with no pattern",
"data": {
"host": [
"http://foo"
]
},
"valid": false
},
{
"description": "Backend declaration with a few components",
"data": {
"host": [
"http://127.0.0.1:8080"
],
"input_headers": [
"Accept"
],
"url_pattern": "/__debug/",
"extra_config": {
"auth/ntlm": {
"user": "user",
"password": "pass"
},
"auth/gcp": {
"audience": "https://gcptest-76fewi6rca-uc.a.run.app",
"credentials_file": "/etc/krakend/gcp.json",
"custom_claims": {
"a": 1
}
},
"backend/http": {
"return_error_code": true,
"@extra_comment": "here"
},
"backend/soap": {
"path": "./path/to.xml",
"content_type": "application/xml",
"debug": false
},
"modifier/body-generator": {
"content_type": "application/json",
"debug": false,
"template": "abcdef"
},
"modifier/response-body-generator": {
"content_type": "application/json",
"debug": false,
"template": "abcdef"
}
}
},
"valid": true
}
]
}
59 changes: 59 additions & 0 deletions test/v2.8/e2e.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"description": "E2E test",
"target": "https://www.krakend.io/schema/v2.8/e2e.json",
"tests": [
{
"description": "Full test-case",
"data": {
"@comment": "Makes sure that the debug endpoint returns a status ok",
"in": {
"method": "GET",
"url": "http://localhost:8080/__debug/something",
"header": {
"User-Agent": "krakend e2e tool"
}
},
"out": {
"status_code": 200,
"body": "http://localhost:8080/__debug/something",
"header": {
"content-type": [
"application/json; charset=utf-8"
],
"Cache-Control": [
""
],
"X-Krakend-Completed": [
"true"
]
},
"schema": {
"title": "A JSON schema",
"description": "some description",
"type": "object",
"properties": {
"abc": {
"type": "array"
}
}
}
},
"next": [
{
"in": {
"method": "GET",
"url": "http://localhost:8080/test/rate-limit-stateless",
"header": {
"User-Agent": "krakend e2e tool"
}
},
"out": {
"status_code": 503
}
}
]
},
"valid": true
}
]
}
38 changes: 38 additions & 0 deletions test/v2.8/flexible_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"description": "Flexible config test",
"target": "https://www.krakend.io/schema/v2.8/flexible_config.json",
"tests": [
{
"description": "Full test-case",
"data": {
"@comment": "Makes sure that the debug endpoint returns a status ok",
"settings": {
"paths": [
"settings"
],
"allow_overwrite": true,
"dir_field_prefix": "",
"allowed_suffixes": [
".yaml",
".json"
]
},
"partials": {
"paths": [
"partials"
]
},
"templates": {
"paths": [
"templates"
]
},
"meta_key": "meta",
"out": "result.json",
"debug": true
},
"valid": true,
"keys_naming_rules": "strict"
}
]
}
18 changes: 18 additions & 0 deletions test/v2.8/modifier/jmespath.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"description": "JMESPath",
"target": "https://www.krakend.io/schema/v2.8/modifier/jmespath.json",
"tests": [
{
"description": "the empty object is invalid",
"data": {},
"valid": false
},
{
"description": "example expression",
"data": {
"expr": "students[?age > `18` ].name"
},
"valid": true
}
]
}
68 changes: 68 additions & 0 deletions test/v2.8/modifier/martian.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{
"description": "martian",
"target": "https://www.krakend.io/schema/v2.8/modifier/martian.json",
"tests": [
{
"description": "two modifiers without group are not possible",
"data": {
"header.Blacklist": {
"scope": [
"response"
],
"names": [
"Vary",
"Etag",
"Last-Modified",
"Expires"
]
},
"header.Modifier": {
"scope": [
"response"
],
"name": "Cache-Control",
"value": "max-age=600, public",
"@comment": "We will change the max-age policy before KrakenD checks the content for caching. Now content is cached 600 seconds."
}
},
"valid": false
},
{
"description": "two modifiers in a group are possible",
"data": {
"fifo.Group": {
"scope": [
"response"
],
"aggregateErrors": true,
"modifiers": [
{
"header.Blacklist": {
"scope": [
"response"
],
"names": [
"Vary",
"Etag",
"Last-Modified",
"Expires"
]
}
},
{
"header.Modifier": {
"scope": [
"response"
],
"name": "Cache-Control",
"value": "max-age=600, public",
"@comment": "We will change the max-age policy before KrakenD checks the content for caching. Now content is cached 600 seconds."
}
}
]
}
},
"valid": true
}
]
}
43 changes: 43 additions & 0 deletions test/v2.8/modifier/response-headers.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"description": "response-headers",
"target": "https://www.krakend.io/schema/v2.8/modifier/response-headers.json",
"tests": [
{
"description": "happy case",
"data": {
"add": {
"X-Hello": [
"World"
]
},
"replace": {
"Cache-Control": [
"no-store"
],
"Vary": [
"foo",
"bar",
"foobar"
]
},
"delete": [
"X-Krakend",
"X-Krakend-Completed"
]
},
"valid": true
},
{
"description":"empty modifiers are not valid",
"data": {
"add": {}
},
"valid": false
},
{
"description":"empty declaration is not allowed",
"data": {},
"valid": false
}
]
}
Loading