-
Notifications
You must be signed in to change notification settings - Fork 139
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
Question regarding upgrade from 0.8.4 to 1.0 #105
Comments
We are still following Google's Address Data service, as used by Android and Chrome. As you can see, it specifies that both the recipient (split into individual first_name/last_name fields in this library) and the addressLine1 are required. You can open an issue in their repo to argue for changing this: https://github.com/googlei18n/libaddressinput/issues In the meantime, you can extend AddressFormatRepository and modify the address format in processDefinition(), make the rules to your liking. And you are correct in noticing that right now no address format uses %additionalName. We've added this field, but Google's not giving us information on where to use it, so we've left it to implementors to decide by themselves, for their own countries. We'll be revisiting this in future releases. |
I looked at {
"locality_name_type":"post_town",
"name":"NORWAY",
"require":"ACZ",
"key":"NO",
"zipex":"0025,0107,6631",
"zip":"\\d{4}",
"id":"data/NO",
"posturl":"http://adressesok.posten.no/nb/postal_codes/search",
"fmt":"%N%n%O%n%A%n%Z %C"
} According to the docs, Where does it say that it requires recipient? From the format ( |
… and I opened an issue as you suggested @bojanz, maybe because I like to argue, and perhaps also because I live in a sparsely populated area of Norway where not having a street address is not at all uncommon 🙂 google/libaddressinput#163 Sorry for making a fuzz here, but upgrading to your version 1.0 have made very common Norwegian organization addresses invalid, like the one I showed above. Previously I "fixed" it with just mapping the organization name to the recipient field, but with the split into given name/family name, that is no longer possible. |
Thanks! Always good to get feedback from people actually using the formats. We'll see what Google says. Keep in mind that you still have full control over all the fields, just override the address format definition. You are right, the recipient is not required in the source data, I misread the definition when I was linking it to you. Looks like requiring firstName/lastName is a port of the v0.8.4 code: https://github.com/commerceguys/addressing/blob/v0.8.4/scripts/generate.php#L286 |
True, but earlier I could just map So I would argue that requiring I guess I have to start with overriding the address format definition then… |
You make a valid point. I'll leave this issue open and look into whether we can make the name fields optional. |
I added two extra properties to an extended So now I can require either |
I am beginning to think the hardcoded family/given name requirement is not a good thing @bojanz. I see plenty of examples of countries where organization name is a perfectly fine addressee, and given/family name of a person is not required. Serbia for instance 😊 |
With the release of 1.0 I started looking at upgrading from 0.8.4. Ran into some issues and have some questions too:
1. Given/family name shouldn't be required
Given name and family name are always required now it seems, yet in Norway it is perfectly legal to send something to an organization and use for example this address format:
For instance:
There is no need to specify a person; you can very well address a shipment to an organization. So you have to specify a recipient, but you are free to use organization name for that purpose too.
Is it possible to adjust the address contraint/validation to require either organization OR given/family name?
2. Address line 1 shouldn't be required
Some addresses in Norway don't require an address line 1 (see https://www.posten.no/sende/klargjoring/adressering). This is for instance a valid format:
I guess this is a minor issue that can be easily fixed in the AddressFormatRepository class, or is requiring address line 1 also intentional?
3. Got an error when trying to use additional name
Seems like the additional name field is not in use by the address formatter, which is probably why I get an error saying the field should be blank when I try to use it in an address. Sorry for not providing code to reproduce this, I'm just wondering if this is expected behavior?
Example NO format:
%givenName %familyName\n%organization\n%addressLine1\n%addressLine2\n%postalCode %locality
The text was updated successfully, but these errors were encountered: