Mandate double quotes around phone numbers#71
Conversation
| email: "francesco.rossi@comune.reggioemilia.it" | ||
| affiliation: Comune di Reggio Emilia | ||
| phone: +39 231 13215112 | ||
| phone: "+39 231 13215112" |
There was a problem hiding this comment.
this is already a string as it contains spaces, and doesn't need quotes.
I am a fan of making things more clear, so I am positive about this change, I am simply pointing out that it's not a real change of the specifictation.
There was a problem hiding this comment.
True, but I thought that this could be the extreme example: if we put double quotes also on a string which is already interpreted as a string in YAML we are passing the idea that it must be explicit.
There was a problem hiding this comment.
We observed several cases where phone numbers had different format, see below:
>>> yaml.safe_load('phone: 01234567')
{'phone': 342391}
>>> yaml.safe_load('phone: 023113215112')
{'phone': 2569869898}
>>> yaml.safe_load('phone: +39023598745')
{'phone': 39023598745}
That's why we need quoting in specification.
There was a problem hiding this comment.
I agree with both of you :-)
We can't mandate the usage of quotes, because that depends on the rules of YAML and the heuristics of the libraries. But it is useful to use double quotes in our examples because that reminds to people who write publiccode.yml files by hand that it's better to use double quotes. Otherwise we should explain "this example does not use quotes because it contains spaces". People are not that expert of YAML :-)
There was a problem hiding this comment.
What @alranel wrote is precisely what I meant! Let's keep quotes for clarity but, technically, that field was already a string
| specification. | ||
| - ``phone`` - phone number (with international prefix) | ||
| - ``phone`` - phone number (with international prefix). This has to be | ||
| a string delimited by double quotes. |
There was a problem hiding this comment.
I would remove the requirement of it being delimited by double quotes, it is an implementation detail and not the only way to properly represent strings in yaml
| siccome questo è permesso dalle specifiche YAML. | ||
| - ``phone`` - Numero telefonico (con prefisso internazionale). | ||
| - ``phone`` - Numero telefonico (con prefisso internazionale). Questa chiave | ||
| deve essere una stringa delimitata da doppi apici. |
ruphy
left a comment
There was a problem hiding this comment.
I tweaked the changelog to reflect the doc... and I think we're ready for a 0.2.1!
Content
This PR mandates to insert the phone number as a string. As such, it mandates to explicitly insert double quotes around the phone number.
Review