-
Notifications
You must be signed in to change notification settings - Fork 56
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
✨ Added struct default validation #425
base: master
Are you sure you want to change the base?
✨ Added struct default validation #425
Conversation
bb726cc
to
f368391
Compare
4224fe8
to
d7cdc95
Compare
Signed-off-by: Sebastian Schleemilch <[email protected]>
d7cdc95
to
bd20706
Compare
Great! Lets discuss on the meeting on Tuesday if we want to allow default for structs. The original limitation was added just as a limitation as we did not at that time prioritized to focus on how to define defaults, so there were no "political" reason to not allow default values. @UlfBj - as you initiated this (in some way) - could you provide some examples on how you want to use default values for structs, so that we can check if it fits proposed syntax and validation |
I think the complete default functionality is discussable whether we want to have it at all. In my opinion it is out of scope for modelling the structure of data. It mixes defining a data structure and actually using it |
Historically we have promoted But I think there is a value in defining a syntax, so that the same spec with default info can be used both for VISSR and Kuksa. But I am open to if it we should consider it to be part of "core CSS syntax", or just a "VSS profile for default", similar to how we sometimes discuss if there should be "standardized" "VSS DBC profile" or "VSS Implementation Type profile" that can tools can decide to support or not. |
Yeah, maybe we can distinguish that a bit. |
Example:
|
MoM:
|
It works fine except I do not understand why JSON is being used 😕 : MODEL: Vehicle:
type: branch
description: Vehicle
Vehicle.DownloadFile:
type: actuator
datatype: Types.Resources.FileDescriptor
default:
name: downloadfile.txt
hash: 20e87e71b6948d6e6dd11d776e9be79c374751bb
uid: 1d878212
description: File to be used by the vehicle. Default contains internal filesystem path.
Vehicle.UploadFile:
type: sensor
datatype: Types.Resources.FileDescriptor
default:
name: uploadfile.txt
hash: 20e87e71b6948d6e6dd11d776e9be79c374751bb
uid: 1d878212
description: File created by the vehicle. Default contains internal filesystem path incl filename. TYPES: Types:
type: branch
description: Types
Types.Resources:
type: branch
description: Resources
Types.Resources.FileDescriptor:
type: struct
description: File Descriptor
Types.Resources.FileDescriptor.name:
type: property
datatype: string
description: Name
Types.Resources.FileDescriptor.hash:
type: property
datatype: string
description: Hash
Types.Resources.FileDescriptor.uid:
type: property
datatype: string
description: UID |
Adding
default
validation support for structsdefault
inputAlso added additional validations
min/max
only on numeric datatypesdefault
being inmin/max
boundaryallowed
to be used with structsExample:
types.vspec
model.vspec with violation (
x
is declared asuint8
):vspec export tree -s model.vspec -t types.vspec
Result:
Fixes #423