Skip to content

keep enumerated attributes when syncing datasets from GeoServer - #14729

Open
mvanhorn wants to merge 1 commit into
GeoNode:masterfrom
mvanhorn:fix/14681-geonode-enum-attribute-sync
Open

mvanhorn wants to merge 1 commit into
GeoNode:masterfrom
mvanhorn:fix/14681-geonode-enum-attribute-sync

Conversation

@mvanhorn

@mvanhorn mvanhorn commented Oct 22, 2026 •

Copy link
Copy Markdown

After a dataset is synced from GeoServer, an attribute that only has a list of allowed values disappears. It is missing from the dataset API, the attribute table, metadata records, statistics, and the viewer attribute list, although WFS still returns the stored values. A row added by hand lasts only until the next layer update, which removes it again.

The sync builds its attribute list from the WFS 1.0.0 DescribeFeatureType document and previously kept only elements that declare a type attribute. An enumeration omits that attribute and puts the type on the base of an anonymous simpleType restriction, so the element was dropped with no log line. The update then replaces the dataset attributes from that incomplete list, deleting any row the list does not contain.

Changes:

  • _resolve_wfs_attribute_type returns the type attribute when it is present and otherwise the base of simpleType/restriction.
  • set_attributes_from_geoserver stores each named element that resolves to a type. It logs a warning for a named element that does not, leaving the attributes already parsed in place.
  • Enumeration values are left unread.
  • The new test feeds a DescribeFeatureType tree with a typed field, an enumerated string, a geometry, and a restriction with no base. It checks the three saved attributes, the preserved label and description, the warning text, and that the catalog fallback is not called.

Testing:

  • black --check geonode/geoserver/helpers.py geonode/geoserver/tests/test_helpers.py reported both files already formatted.
  • pytest -q geonode/geoserver/tests/test_helpers.py did not run the new test; collection failed because requests could not be imported.
  • make test did not run the suite locally; docker-compose up failed because .env is missing. It fails the same way on upstream/master.

Checklist

Reviewing is a process done by project maintainers, mostly on a volunteer basis. We try to keep the overhead as small as possible and appreciate if you help us to do so by completing the following items. Feel free to ask in a comment if you have troubles with any of them.

For all pull requests:

  • Confirm you have read the contribution guidelines
  • You have sent a Contribution Licence Agreement (CLA) as necessary (not required for small changes, e.g., fixing typos in the documentation)
  • Make sure the first PR targets the master branch, eventual backports will be managed later. This can be ignored if the PR is fixing an issue that only happens in a specific branch, but not in newer ones.

The following are required only for core and extension modules (they are welcomed, but not required, for contrib modules):

Submitting the PR does not require you to check all items, but by the time it gets merged, they should be either satisfied or inapplicable.

Fixes #14681

@cla-bot

cla-bot Bot commented Oct 22, 2026

Copy link
Copy Markdown

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have the users @mvanhorn on file. In order for us to review and merge your code, please contact the project maintainers to get yourself added.

_resolve_wfs_attribute_type returns the type attribute when it is
present and otherwise the base of simpleType/restriction.
set_attributes_from_geoserver stores each named element that resolves to
a type, and logs a warning for a named element that does not, leaving
the attributes already parsed in place. Enumeration values are left
unread. The new test feeds a DescribeFeatureType tree with a typed
field, an enumerated string, a geometry, and a restriction with no base,
and checks the three saved attributes, the preserved label and
description, the warning text, and that the catalog fallback is not
called.

Fixes GeoNode#14681
@mvanhorn
mvanhorn force-pushed the fix/14681-geonode-enum-attribute-sync branch from b21ccb8 to d7a733c Compare October 25, 2026 16:06
@cla-bot

cla-bot Bot commented Oct 25, 2026

Copy link
Copy Markdown

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have the users @mvanhorn on file. In order for us to review and merge your code, please contact the project maintainers to get yourself added.

@mvanhorn

Copy link
Copy Markdown
Author

I rebased onto master to clear a conflict in geonode/geoserver/tests/test_helpers.py (d7a733c). The new remote WMS dataset test from master and this PR's enumerated-attribute test now sit side by side, and black and flake8 pass on both changed files.

The cla-bot says I'm not on file and to contact the maintainers to get added. What's the process for that here? Happy to do whatever is needed.

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

Successfully merging this pull request may close these issues.

Attributes with allowed values (enumerations) are dropped when syncing from GeoServer

1 participant