Skip to content
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

Problem with attribute values #187

Closed
jmdacruz opened this issue Apr 29, 2015 · 6 comments
Closed

Problem with attribute values #187

jmdacruz opened this issue Apr 29, 2015 · 6 comments

Comments

@jmdacruz
Copy link

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:

  • Attributes (object)
    • uuid: 08ff7052-2e95-11e3-a1fc-000c294eede0 (guid) - Unique ID
    • date: 2014-07-14T12:03:20z (date) - A date

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?

@kylef
Copy link
Member

kylef commented Apr 29, 2015

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

@kylef kylef closed this as completed Apr 29, 2015
@jmdacruz
Copy link
Author

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.

@kylef
Copy link
Member

kylef commented Apr 29, 2015

@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)

@jmdacruz
Copy link
Author

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.

@honzajavorek
Copy link
Contributor

@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.

@jmdacruz
Copy link
Author

Great, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants