Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

feat(api): use geojson-pydantic as request model #824

Merged
merged 1 commit into from
Sep 27, 2024
Merged

Conversation

matthiasschaub
Copy link
Collaborator

@matthiasschaub matthiasschaub commented Sep 26, 2024

Description

use Pydantic model from the geojson-pydantic library as request model for bpolys.

Corresponding issue

Closes #704

New or changed dependencies

  • pydantic-geojson

Checklist

  • I have updated my branch to main (e.g. through git rebase main)
  • My code follows the style guide and was checked with pre-commit before committing
  • I have commented my code
  • I have added sufficient unit and integration tests
  • I have updated the CHANGELOG.md

use Pydantic model from the `geojson-pydantic` library as request model
for `bpolys`.

Closes #704
(Closes #704)
@matthiasschaub matthiasschaub added the waiting for review This pull request urgently needs a code review label Sep 26, 2024
@mmerdes mmerdes self-requested a review September 26, 2024 12:32
Copy link
Collaborator

@mmerdes mmerdes left a comment

Choose a reason for hiding this comment

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

LGTM ✅

@@ -20,8 +19,11 @@ class BaseConfig(BaseModel):
)


FeatureCollection_ = FeatureCollection[Feature[Polygon | MultiPolygon, Dict]]
Copy link
Collaborator

Choose a reason for hiding this comment

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

I assume the underscore postfix is for avoiding name collisions?

validate_geojson(obj) # Check if exceptions are raised
return obj
def transform(cls, value) -> geojson.FeatureCollection:
# NOTE: `geojson_pydantic` library is used only for validation and openAPI-spec
Copy link
Collaborator

Choose a reason for hiding this comment

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

good explanation ;)

@mmerdes mmerdes merged commit c2db3ea into main Sep 27, 2024
4 checks passed
@mmerdes mmerdes deleted the geojson-pydantic branch September 27, 2024 13:35
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
waiting for review This pull request urgently needs a code review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants