I'm trying to define an attribute with a value that is a GUID, but I don't seem to find the way to properly express this:
When doing the above, the parser seems to cut the definition on the first "-", which means that the first portion of the string is considered the example value (e.g., "08ff7052") and the second portion is considered to be part of the description (e.g., "2e95-11e3-a1fc-000c294eede0 (guid) - Unique ID")
I'm probably doing something wrong... can you point me in the right direction?
When a literal contains reserved characters such as -
it needs to be wrapped in backticks. See reserved characters & keywords.
It should look something like the following:
+ Attributes (object)
+ uuid: `08ff7052-2e95-11e3-a1fc-000c294eede0` (guid) - Unique ID
+ date: `2014-07-14T12:03:20z` (date) - A date
Thanks, that did part of the trick... but it also seems I can't define custom data types (e.g., "guid" or "date"), since I also get an error when doing that.
@jmdacruz You would need to declare them in the Data Structures
section. Such as the following:
+ Attributes (object)
+ uuid: `08ff7052-2e95-11e3-a1fc-000c294eede0` (guid) - Unique ID
+ date: `2014-07-14T12:03:20z` (date) - A date
# Data Structures
## guid (string)
## date (string)
Doh! thanks, I had missed that. Is there a way to attach regular expressions to these user-defined data structures? If not, it might be a nice-to-have.
@jmdacruz You could provide custom Schema section and use JSON Schema's regular expressions. In the future, we consider to have Validations right in the user-defined data structures.
Great, thanks!
Most helpful comment
When a literal contains reserved characters such as
-
it needs to be wrapped in backticks. See reserved characters & keywords.It should look something like the following: