Add version validation when the user converts a Tm to Td #162
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.
This PR improves version handling in the conversion from Thing Model to Thing Description.
The bug is described in issue #137.
Previously, when a user converted a Thing Model to a Thing Description that included a version key, the conversion succeeded without validating the instance property inside the version object. As a result, although the generation was successful, the validation process would later raise an error.
This update introduces the following improvements:
Detects whether the version key exists in the parsed Thing Model.
Validates the format of the version value (must be either an object with an instance property or a string).
Allows users to provide a custom instance value via an input field in the ToTD dialog.
Automatically generates a Unix timestamp as the instance value if the user input is empty.
Properly updates the generated Thing Description with the validated instance value.
Typecript checks were improvement.