Skip to content

Conversation

@KatKatKateryna
Copy link

@KatKatKateryna KatKatKateryna commented Dec 19, 2025

Overview

This PR is fixing the behavior of overwriting example-config.yaml via admin API. Currently, the data is received correctly but YAML writer is representing datetime objects and special characters incorrectly:
image

image

To fix this, YAML writer now has 'allow_unicode=True' and 'Dumper=MyDumper', where MyDumper is an instance of yaml.SafeDumper with correct datetime object representers.

Related Issue / discussion

This was discovered while working on QGIS pygeoapi-config plugin: correctly sent data is being saved incorrectly on the running pygeoapi instance: byteroad/pygeoapi_config#12

Additional information

Dependency policy (RFC2)

  • I have ensured that this PR meets RFC2 requirements

Updates to public demo

Contributions and licensing

(as per https://github.com/geopython/pygeoapi/blob/master/CONTRIBUTING.md#contributions-and-licensing)

  • I'd like to contribute [feature X|bugfix Y|docs|something else] to pygeoapi. I confirm that my contributions to pygeoapi will be compatible with the pygeoapi license guidelines at the time of contribution
  • I have already previously agreed to the pygeoapi Contributions and Licensing Guidelines

Copy link
Contributor

@doublebyte1 doublebyte1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @KatKatKateryna ! 🌟 A couple of things:

Copy link
Contributor

@doublebyte1 doublebyte1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See my comments above, Thanks!

@KatKatKateryna
Copy link
Author

@doublebyte1 Thanks! I am not sure about the test, because the only relevant check is for 'put_config' method, but it only checks for the return code. In the end of the method, though, it does call 'admin.write(data)' where the change was made, but the affected function only writes data to YAML and never does any validation from that file. So the only way it would affect the test, is if the yaml writer fails for some reason.

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.

2 participants