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

Documentation improvements #31

Merged
merged 4 commits into from
Dec 5, 2020
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
10 changes: 2 additions & 8 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,9 @@ on:
push:
branches:
- master
paths:
- '**/src/*'
- '.github/workflows/*'
pull_request:
paths:
- '**/Cargo.toml'
- '**/src/*'
- '.github/workflows/*'

branches:
- master

name: library-tests

Expand Down
4 changes: 3 additions & 1 deletion examples/all-types/customers.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
---
- name: Teodor Fælgen
- name:
first name: Teodor
last name: Fælgen
cars:
work:
year: 1908
Expand Down
21 changes: 20 additions & 1 deletion examples/all-types/schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,37 @@ schema:
type: string
price:
type: real
minimum: 0.00

---
uri: customer-name
schema:
oneOf:
- type: object
items:
first name:
type: string
last name:
type: string
required:
- first name
- last name
- type: string

---
uri: customer
schema:
type: object
items:
name:
type: string
$ref: customer-name
cars:
type: hash
items:
$ref: car
required:
- name
- cars

---
uri: customer-list
Expand Down
9 changes: 9 additions & 0 deletions examples/locating-errors/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
This example is designed to *fail* the schema validation, it is not an example of a valid schema/yaml file setup!

Use the following command to show an example of the error codes produced by this tool, when validation fails:
```shell
yaml-validator-cli \
--schema schema.yaml \
--uri phonebook \
phonebook.yaml
```
8 changes: 1 addition & 7 deletions examples/locating-errors/phonebook.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,4 @@
- name: Karen
age: 12.5
- name: 200
age: Jimmy

# example usage:
# yaml-validator-cli \
# --schema schema.yaml \
# --uri phonebook \
# phonebook.yaml
age: Jimmy
9 changes: 9 additions & 0 deletions examples/multiple-schemas/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
This example demonstrates a schema specified in multiple separate files, and then using the following command line to validate a single yaml file ('mybook.yaml') against a single root uri (`phonebook` defined in [phonebook-schema.yaml](phonebook-schema.yaml)) within the context of these files:

```shell
yaml-validator-cli \
--schema person-schema.yaml \
--schema phonebook-schema.yaml \
--uri phonebook \
mybook.yaml
```
9 changes: 1 addition & 8 deletions examples/multiple-schemas/mybook.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,4 @@ phonebook:
- name: timmy
phone: 123456
- name: tammy
phone: 987654

# example usage:
# yaml-validator-cli \
# --schema person-schema.yaml \
# --schema phonebook-schema.yaml \
# --uri phonebook \
# mybook.yaml
phone: 987654