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

Record UI Serialization fails for Locations with Polygon geometries #1918

Open
spilth opened this issue Dec 17, 2024 · 0 comments
Open

Record UI Serialization fails for Locations with Polygon geometries #1918

spilth opened this issue Dec 17, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@spilth
Copy link

spilth commented Dec 17, 2024

Package version: 16.5.1

Describe the bug

I am creating records in Invenio RDM where the Locations metadata field contains a Polygon. I am able to post these records via the REST API successfully, but when I go to view the record via the web interface the page fails with the error:

TypeError: float() argument must be a string or a number, not 'list'

I believe this is caused by a limitation in this repo's code.

Steps to Reproduce

  1. Create a record with a polygon location:
"geometry": {
    "type": "Polygon",
    "coordinates": [[[0, 0], [1, 0], [1, 1], [0, 1], [0, 0]]],
},
  1. Dump the object using UIJSONSerializer().dump_obj(full_to_dict_record)

Expected behavior

The JSON contains the coordinates provide in the original record.

Actual behavior

Receive the error: TypeError: float() argument must be a string or a number, not 'list'

Additional context

This appears to be cause by the UI Serializer's GeometrySchema only expecting/supporting Point coordinates.

If you use the REST API to upload a record with non-Point locations, it breaks the search page and record indexing.

@spilth spilth added the bug Something isn't working label Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant