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

Fixing pydantic validation issue of tilejson metadata #1421

Merged
merged 3 commits into from
Dec 8, 2023

Conversation

doublebyte1
Copy link
Contributor

@doublebyte1 doublebyte1 commented Dec 7, 2023

Overview

The tileset metadata endpoint for tilejson metadata is no longer working.

Related Issue / Discussion

#1418

Additional Information

This issue is related to the upgrade of the pydantic version: #1353

According to this, pydantic2 requires all the optional fields to be present, unless they have a default value of None. This PR adds defaults values to all the optional fields, so that we continue to instantiate the model, without having all the information.

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

@ricardogsilva
Copy link
Member

ricardogsilva commented Dec 7, 2023

+1

This is a consequence of migrating to pydantic V2, where the Optional type annotation no longer makes pydantic provide an automatic intialization value of None - more info here (see the note box):

https://docs.pydantic.dev/latest/concepts/models/#required-fields

@PascalLike
Copy link
Member

The same potential issue also here https://github.com/geopython/pygeoapi/blob/master/pygeoapi/models/provider/base.py

@francbartoli francbartoli merged commit f1a0357 into geopython:master Dec 8, 2023
2 checks passed
@doublebyte1 doublebyte1 deleted the pydantic2 branch December 17, 2023 03:48
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.

4 participants