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

Replace subdivision_depth with subdivision_data_fields #213

Open
bojanz opened this issue Feb 25, 2024 · 0 comments
Open

Replace subdivision_depth with subdivision_data_fields #213

bojanz opened this issue Feb 25, 2024 · 0 comments

Comments

@bojanz
Copy link
Contributor

bojanz commented Feb 25, 2024

Right now each address format has a subdivision_depth, used to determine whether to attempt to load subdivisions of a specific level.

The depth is an integer, which is imprecise, as it requires us to also look up the used fields. For example, "AD" has a subdivision_depth of 1, but the predefined subdivisions are localities, not administrative areas.

Let's replace subdivision_depth with subdivision_data_fields, which is an array of field names.
So, before:

'subdivision_depth' => 2,

After:

'subdivision_data_fields' => ['administrativeArea', 'locality'],

The matching getter (getSubdivisionDataFields) could also replace getUsedSubdivisionFields().

The benefit of this, other than explicitness, is to enable future subdivision data opt-in. For example, we could define administrative areas for Hungary (as PR 208 does), define subdivision_data_fields, but keep administrativeArea out of the format itself. Then, anyone who wants to have these administrative areas (even though they're not required for addressing) could simply alter the format itself (or we could have an opt-in setting on our side), without the need to touch subdivision_depth.

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

No branches or pull requests

1 participant