-
Notifications
You must be signed in to change notification settings - Fork 4
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
integer vs. string for numerical codes and identifiers #60
Comments
When it comes to identifiers I think we cannot treat them as numericals by default. I think we should always treat them as a character sequence. Operations like +, -, *, /, mod are not defined for identifiers. So we should not treat them as numericals. By treating it as an identifier we also ensure data interoperability because applications are not using it in an non-intentional usage. Like e.g. deriving from the identifier the age of person. From a data-perspective that is dangerous. |
WG of May 2020 - decision deferred until next time:
Smals currently uses integer types for SOAP services when leading zeros are possible. Current examples:
|
If integer in URLs; multiple representations possible: /employers/0123456789 => should it redirect to /employers/123456789 to keep resource URI unique? String for all numerical ids is a big departure from existing systems and habits (e.g. GenderCode) |
I'm writing an in-depth wiki page like for the problem type discussion: https://github.com/belgif/rest-guide/wiki/integer-vs.-string-for-numerical-codes-and-identifiers |
Proposal A accepted on WG, with for fixed length numbers that don't allow leading zeroes: as integers. I'll work on a pull request to document this in the guide |
Impact on existing openapi data types:
Unchanged:
To discuss:
|
PR #84 with guide changes ready for review |
PR was merged. |
During discussion of the representation of EmployerId (= nsso number + variants), the question surfaced if it shouldn't be represented by an integer instead of a string because in (human) input, the leading zeros are often omitted. The same could be said for EnterpriseNumber, where the first digit can be omitted if it is zero (the format doesn't permit two leading zeros).
One could also represent this as a string with a regular expression, but this may lead to programming bugs when comparing values:
We currently have this rule ; it would need to be tweaked to allow this:
a) as string:
b) as integer:
(similar for EstablishmentUnitNumber and CbeNumber)
For Ssin, string representation should still be kept, because its fixed length and leading zeros have a meaning (year of birth).
The text was updated successfully, but these errors were encountered: