Skip to content

Commit

Permalink
Update Code Validation Docs to Include Validate-Exists Marker
Browse files Browse the repository at this point in the history
  • Loading branch information
thsparks committed Nov 2, 2023
1 parent b55b9f4 commit f22a811
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions docs/writing-docs/tutorials/basics.md
Original file line number Diff line number Diff line change
Expand Up @@ -275,9 +275,11 @@ Within a validation section, you may specify which validators you want to enable

### Validators

Currently, only one validator exists: the `BlocksExistValidator`. This validator looks at [highlighted blocks](../snippets.md#highlight) in the answer key and confirms that, for each highlighted block, the user's code contains at least one block of the same type. It does *not* validate the parameters passed into the block.
Currently, only one validator exists: the `BlocksExistValidator`. This validator looks at blocks tagged with `//@validate-exists` or `//@highlight` comments in the answer key and confirms that, for each tagged block, the user's code contains at least one block of the same type. It does *not* validate the parameters passed into the block. For more information on highlighting, see [highlighted blocks](../snippets.md#highlight).

The only property currently available on the `BlocksExistValidator` is `Enabled`, which determines whether or not the validator runs. This is `true` by default whenever you specify the validator but can be set to `false` if you wish to disable it on a single step.
You can specify whether the `BlocksExistValidator` checks for `//@validate-exists` or `//@highlight` using the `markers` property on the validator. If you specify only `validate-exists`, then highlighted blocks will not be validated. Similarly, if you specify only `highlight`, then blocks marked with `validate-exists` will not be checked. By default, both checks are enabled.

The `BlocksExistValidator` also has an `Enabled` property that determines whether or not the validator runs at all. This is `true` by default whenever you specify the validator but can be set to `false` if you wish to disable it on a single step.

### Examples
**Enable the `BlocksExistValidator` globally**
Expand All @@ -287,6 +289,15 @@ The only property currently available on the `BlocksExistValidator` is `Enabled`
```
````

**Enable the `BlocksExistValidator` globally and ignore highlighted blocks**
_Note: highlight is not specified in the markers property._
````
```validation.global
# BlocksExistValidator
* markers: validate-exists
```
````

**Disable the `BlocksExistValidator` on a single step, if it has been enabled globally**
````
```validation.local
Expand Down

0 comments on commit f22a811

Please sign in to comment.