ajv-validator / ajv-validator/ajv-cli

Multiple YAML documents per file / NDJSON

Đang mở
#247 0 bình luận 2 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
TypeScript
Star
316
Fork
77
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

Nobody else seems to have discussed this, but it seems to be impossible `ajv-cli` to validate YAML files that contain multiple documents. My underlying goal is replacing `RoadieHQ/backstage-entity-validator` with more pure AJV, because BEV does not permit passing many of the AJV options.

The validator seems to throw strange errors
```
error: Invalid left-hand side expression in prefix operation
error: Unexpected identifier 'REDACTED-INTERNAL-STRING'
error: Unexpected token 'for'
```

I don't want to split the documents up into multiple files because I'd like to return original document line number references to the errors, to help end-users fix their documents.

`data/schemas/allOf.v1alpha1.schema.json` contains an `allOf` array w/ if/then conditionals to select between different schemas based on a value in a top-level key (it's not the name of the top-level key, so I can't use `discriminator`). The globbing hack is to avoid ingesting the `allOf` schema twice.

```
ajv validate --all-errors --spec=draft7 -r 'data/schemas.upstream/**/*.schema.json' -r 'data/schemas/!(allOf.v1alpha1).schema.json' -s data/schemas/allOf.v1alpha1.schema.json --validate-formats=true --strict=log -c ajv-keywords -c ajv-formats --verbose --data --errors=text -d $DOCUMENT_YAML
```

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.