batch-schema-validator
Validator for Batch Schemas for JANIS BATCH SERVICE
📦 Usage (command line)
npx @janiscommerce/batch-schema-validator
⚙️ Configuration
- Schemas MUST be located at:
batch-schemas
|__import
|____entity.yml
|__export
|____entity.yml
|
src
⚠️ Important
-
Any other location will be ignored
-
The batch schemas files must be
.yml
or.yaml
. Any other file types will be skipped after showing warning. -
If there is not any source files in the specified input directory no error will be thrown
Import Schema Struct
Each Import Schema will be validated according the following struct
fields: string
- name: string
label: string
field: string
isArray: boolean
separator: string
format: array
name: string
props: object
nullable: boolean
Fields (REQUIRED)
- name: REQUIRED.
- label: OPTIONAL.
- field: OPTIONAL.
- isArray: OPTIONAL.
-
separator:OPTIONAL. Default value --->
,
- format OPTIONAL.
- nullable OPTIONAL.
Check here for more info about import schemas.
Export Schema Struct
Each Import Schema will be validated according the following struct
dependencies:
- name: string
source:
service: string
namespace: string
method: string
filters:
id: string
fields:
- name: string
label: string
dependsOn: string
field: string
(OPTIONAL)
Dependencies - name: REQUIRED.
-
source: REQUIRED.
- service: REQUIRED.
- namespace: REQUIRED.
-
method: REQUIRED. Valid values --->
list
- filters: REQUIRED.
(REQUIRED)
Fields - name: REQUIRED.
- label: OPTIONAL.
- field: OPTIONAL.
-
separator:OPTIONAL. Default value --->
,
-
format OPTIONAL.
- name: REQUIRED.
- props: REQUIRED.
Check here for more info about export schemas.
Error types
It also uses the following error codes:
Name | Value | Description |
---|---|---|
Read files | 1 | Something went wrong while reading source files. Not related with schemas errors |
Schema validation | 2 | Invalid schemas were found |
Parsing schema | 3 | Something went wrong while parsing source files from yml/yaml to json
|
Validated Errors
- Struct Errors
- Value Type Errors
- Required fields
Validated Warnings
- Extra properties in schemas
- Default values
- Redundant properties definitions