543 - update: to use updated config structure

This commit is contained in:
ameersohel45
2025-11-14 13:06:31 +05:30
parent 9f913e6aa9
commit 75880a4458
5 changed files with 106 additions and 54 deletions

View File

@@ -17,7 +17,8 @@ Validates Beckn protocol requests against OpenAPI 3.1 specifications using kin-o
schemaValidator:
id: schemav2validator
config:
url: https://example.com/openapi-spec.yaml
type: url
location: https://example.com/openapi-spec.yaml
cacheTTL: "3600"
```
@@ -25,9 +26,12 @@ schemaValidator:
| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| `url` | string | Yes | - | URL or file path to OpenAPI 3.1 specification |
| `type` | string | Yes | - | Type of spec source: "url" or "file" ("dir" reserved for future) |
| `location` | string | Yes | - | URL or file path to OpenAPI 3.1 spec |
| `cacheTTL` | string | No | "3600" | Cache TTL in seconds before reloading spec |
## How It Works
1. **Load Spec**: Loads OpenAPI spec from configured URL at startup
@@ -94,26 +98,30 @@ The loader will automatically fetch and resolve the external reference.
## Example Usage
### Local File
```yaml
schemaValidator:
id: schemav2validator
config:
url: ./validation-scripts/l2-config/mobility_1.1.0_openapi_3.1.yaml
cacheTTL: "3600"
```
### Remote URL
```yaml
schemaValidator:
id: schemav2validator
config:
url: https://raw.githubusercontent.com/beckn/protocol-specifications/master/api/beckn-2.0.0.yaml
type: url
location: https://raw.githubusercontent.com/beckn/protocol-specifications/master/api/beckn-2.0.0.yaml
cacheTTL: "7200"
```
### Local File
```yaml
schemaValidator:
id: schemav2validator
config:
type: file
location: ./validation-scripts/l2-config/mobility_1.1.0_openapi_3.1.yaml
cacheTTL: "3600"
```
## Dependencies
- `github.com/getkin/kin-openapi` - OpenAPI 3 parser and validator