summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolai Cornelis <[email protected]>2024-10-26 03:42:58 +0200
committerNicolai Cornelis <[email protected]>2024-10-26 03:42:58 +0200
commite2fd52ee6d3b9cc9dad0e0df4578b63bcdaa2738 (patch)
treecf3c27c9f4e02e400bb00e0a4ea3fdb3939f53ef
parent7c91597496ea58016e52ab232352d219d47cadbf (diff)
Remove inline schema ref
Fix invalid metrics examples Adjust workflow file
-rw-r--r--.github/workflows/schema.yaml13
-rw-r--r--.rr.yaml79
-rw-r--r--schemas/test.js8
3 files changed, 47 insertions, 53 deletions
diff --git a/.github/workflows/schema.yaml b/.github/workflows/schema.yaml
index 847f52b9..4c33f65d 100644
--- a/.github/workflows/schema.yaml
+++ b/.github/workflows/schema.yaml
@@ -5,12 +5,21 @@ on:
branches:
- master
- stable
+ paths:
+ - 'schemas/**'
+ - '.github/workflows/schema.yaml'
pull_request:
+ paths:
+ - 'schemas/**'
+ - '.github/workflows/schema.yaml'
jobs:
validate-json-schema:
name: Validate JSON Schema files
runs-on: ubuntu-latest
+ defaults:
+ run:
+ working-directory: ./schemas
steps:
- name: Check out code
uses: actions/checkout@v4
@@ -18,12 +27,10 @@ jobs:
- name: Setup nodejs
uses: actions/setup-node@v4
with:
- node-version: "22"
+ node-version: "20"
- name: Install Test Script Dependencies
run: npm install
- working-directory: ./schemas
- name: Run Script
run: node test.js
- working-directory: ./schemas
diff --git a/.rr.yaml b/.rr.yaml
index 2039d84a..13147a7b 100644
--- a/.rr.yaml
+++ b/.rr.yaml
@@ -4,7 +4,6 @@
# MORE DOCS CAN BE FOUND HERE: <https://roadrunner.dev/docs/intro-config> #
######################################################################################
-$schema: "./schemas/config/3.0.schema.json"
# Production usage guide: https://roadrunner.dev/docs/app-server-production/2.x/en
# Hint: RR will replace any config options using reference to environment variables,
@@ -192,61 +191,47 @@ temporal:
#
# Optional section
metrics:
-
- # ---- Prometheus
-
- # Metrics driver to use
- #
- # Optional, default: prometheus. Available values: prometheus, statsd
- driver: prometheus
# Server metrics address
- #
# Required for the production. Default: 127.0.0.1:9091, for the metrics 127.0.0.1:9091/metrics
address: 127.0.0.1:9091
- # Metrics type
- #
- # Default: "summary". Supported values: summary, histogram
- type: "summary"
-
- # Temporal metrics prefix
- #
- # Default: (empty)
- prefix: "foobar"
-
- # ---- Statsd (uncomment)
# Metrics driver to use
- #
# Optional, default: prometheus. Available values: prometheus, statsd
- # driver: statsd
-
- # Statsd host and port
- #
- # Optional, default: 127.0.0.1:8125
- # host_port: "127.0.0.1:8125"
-
- # Prefix for the metrics
- #
- # Optional, default: empty
- # prefix: "samples"
-
- # Flush interval is the maximum interval for sending packets.
- #
- # Optional, default: 1s
- # flush_interval: 1s
+ driver: prometheus
- # Flush bytes specifies the maximum udp packet size you wish to send.
- # If FlushBytes is unspecified, it defaults to 1432 bytes, which is
- # considered safe for local traffic
- #
- # Optional, default: 1432
- # flush_bytes: 1432
+ # ---- Prometheus
+ prometheus:
+ # Metrics type
+ type: "summary"
+ # Temporal metrics prefix
+ # Default: (empty)
+ prefix: "foobar"
- # Tags passed to the statsd on init
- #
- # Optional, default: empty
+ # ---- Statsd (uncomment)
+ # Statsd host and port
+ #statsd:
+ # Optional
+ # default: 127.0.0.1:8125
+ # host_port: "127.0.0.1:8125"
+ #
+ # Prefix for the metrics
+ # Optional, default: empty
+ # prefix: "samples"
+ #
+ # Flush interval is the maximum interval for sending packets.
+ # Optional, default: 1s
+ # flush_interval: 1s
+ #
+ # Flush bytes specifies the maximum udp packet size you wish to send.
+ # If FlushBytes is unspecified, it defaults to 1432 bytes, which is
+ # considered safe for local traffic
+ # Optional, default: 1432
+ # flush_bytes: 1432
+ #
+ # Tags passed to the statsd on init
+ # Optional, default: empty
#tags:
- # - foo: bar
+ # foo: bar
# Temporal TLS configuration
#
diff --git a/schemas/test.js b/schemas/test.js
index d0e6f8d2..cd469c3a 100644
--- a/schemas/test.js
+++ b/schemas/test.js
@@ -12,7 +12,7 @@ function stripIds(schema, first) {
delete schema.$schema;
}
for (const key in schema) {
- if (schema.hasOwnProperty(key)) {
+ if (Object.hasOwn(schema, key)) {
stripIds(schema[key], false);
}
}
@@ -25,7 +25,7 @@ const dereferenced = await $RefParser.dereference('./config/3.0.schema.json');
// Remove $id and $schema from anything but the root
stripIds(dereferenced, true);
-const ajv = new Ajv2019({strict: true})
+const ajv = new Ajv2019({strict: true, allErrors: true})
const validator = ajv.compile(dereferenced)
const data = fs.readFileSync('../.rr.yaml', 'utf-8');
@@ -33,5 +33,7 @@ const schema = yaml.load(data);
// Validate the file
if (!validator(schema)) {
- throw new Error("Errors: " + JSON.stringify(validator.errors))
+ throw new Error(JSON.stringify(validator.errors, null, 2))
+} else {
+ console.log('No errors found in schemas.')
}