"Enforce required keys and enforce defaults" makes code needlessly cumbersome
curieux opened this issue · 0 comments
curieux commented
Regarding the change issued here
https://github.com/developmentseed/geojson-pydantic/blob/main/CHANGELOG.md#060a0---2023-04-04
# Before
Feature(geometry=Point(coordinates=(0,0)))
# Now
Feature(
type="Feature",
geometry=Point(
type="Point",
coordinates=(0,0)
),
properties=None,
)
This change is unfortunate for a few reasons:
- it violates semantic versioning, because the fundamental call has changed in an incompatible way without a major version change https://semver.org/
- it is incorrect to say that the old system did not follow the GeoJSON spec. The GeoJSON spec is about JSON, not about Python objects. As long as the
@validator
and.json()
work correctly, GeoJSON is met. - it is unpythonic to repeat identical information
Feature(type='Feature", ...
We have been using geojson-pydantic for several projects, and have had to issue patches (or pin to <0.6.0) throughout.