-
Notifications
You must be signed in to change notification settings - Fork 157
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding name recommendations for allowed values
- Loading branch information
Showing
2 changed files
with
37 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
--- | ||
title: "Value restrictions" | ||
date: 2019-08-04T12:37:12+02:00 | ||
weight: 5 | ||
--- | ||
|
||
Optionally it is possible to define an array of `allowed` values, which will restrict the usage of the data entry in the implementation of the specification. | ||
It is expected, that any value not mentioned in the array is considered an error and the implementation of the specification shall react accordingly. | ||
The datatype of the array elements is the `datatype` defined for the data entry itself. | ||
For `attributes` it is possible to optionally set a default value. | ||
|
||
```YAML | ||
SteeringWheel.Position: | ||
datatype: string | ||
type: attribute | ||
default: FRONT_LEFT | ||
allowed: [FRONT_LEFT, FRONT_RIGHT] | ||
description: Position of the steering wheel on the left or right side of the vehicle. | ||
|
||
``` | ||
|
||
If `allowed` is set, `min` or `max` cannot be defined. | ||
|
||
The `allowed` element is an array of values, all of which must be specified | ||
in a list. Only values can be assigned to the data entry, which are | ||
specified in this list. | ||
|
||
The `datatype` specifier gives the type of the individual elements of the `allowed` | ||
list. | ||
|
||
For string values used for `default` and `allowed` statements it is recommended to start with `A-Z` | ||
and then use only `A-Z`, `0-9` and underscore (`_`). | ||
Single(`'`) and double (`"`) quotes shall be used only if necessary, and are not needed if the naming recommendation is followed. | ||
It is recommended not to specify a dedicated value corresponding to "unknown" or "undefined" unless there is a relevant use-case for that particular signal. | ||
The background is that a signal with an array of allowed values shall be handled just as any other signal. | ||
If e.g. the value of current speed or vehicle weight is unknown, then the vehicle shall not publish the corresponding signal. | ||
Similarly, for the example above, if the steering wheel position is unknown then `SteeringWheel.Position`shall not be published. |
This file was deleted.
Oops, something went wrong.