-
Notifications
You must be signed in to change notification settings - Fork 170
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
Adding concept of 'format' #771
Draft
sschleemilch
wants to merge
1
commit into
COVESA:master
Choose a base branch
from
sschleemilch:feature/formats
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,48 @@ | ||
--- | ||
title: "Data Formats" | ||
date: 2024-08-29T12:36:12+02:00 | ||
weight: 25 | ||
--- | ||
|
||
## Data Formats | ||
|
||
For some data it is necessary to specify the format. | ||
An example are dates. | ||
Let's say we specify a leaf e.g. `Vehicle.ProductionDate` and give it | ||
the datatype `string`. How would a consumer know what to expect in this string? | ||
It could be ISO8601, it could be a unix-timestamp or it could be something totally different. | ||
To provide that info, a `format` field can be used. | ||
|
||
A complete definition of a `ProductionDate` field could then look like this: | ||
|
||
```yaml | ||
Vehicle.ProductionDate: | ||
description: The production date of the car | ||
datatype: string | ||
format: iso8601 | ||
``` | ||
|
||
All formats being used have to be specified in format definition files. | ||
|
||
## Format definitions file | ||
|
||
It has the following format: | ||
|
||
```yaml | ||
unix-time: | ||
description: Unix Timestamp | ||
allowed-datatypes: ['uint32','uint64','int64'] | ||
``` | ||
|
||
Both fields are required: | ||
- `description`: Should specify how the format is specified | ||
- `allowed-datatypes`: Datatypes allowed when using this format. The consistency will be enforced by `vss-tools` | ||
|
||
Please note that you can either specify `unit` or `format`. | ||
|
||
|
||
## Supported Data Formats in VSS Standard Catalog | ||
|
||
The catalog defines common formats in the `formats.yaml` file similar to how units are handled. `vss-tools` provides an interface to pass one or more format files. | ||
Like with unit files, `formats.yaml` will be loaded if it is present on the level | ||
of the given entry point `vspec` file. |
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
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
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
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
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,15 @@ | ||
unix-time: | ||
description: Unix time in seconds | ||
allowed-datatypes: ['uint32','uint64','int64'] | ||
unix-time-ms: | ||
description: Unix time in milliseconds | ||
allowed-datatypes: ['uint32','uint64','int64'] | ||
iso8601: | ||
description: Date and Time expressed as a string according to ISO 8601 | ||
allowed-datatypes: ['string'] | ||
ipv4: | ||
description: Internet Protocol version 4 | ||
allowed-datatypes: ['string'] | ||
ipv6: | ||
description: Internet Protocol version 6 | ||
allowed-datatypes: ['string'] |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to discuss if we still want to use something like
quantity
for formats, to indicate that some formats represent the same type of content, like if you useiso8601
you could possibly convert it tounix-time-ms
, but not toipv4
.If we do not want to reuse the quantity concept then we should possibly remove
datetime
from the quantity file.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good point. I did not think about quantities so much here