BDMS-227-254: add schema validations to aquifer and geology schemas#266
Merged
ksmuczynski merged 5 commits intoDec 2, 2025
Merged
Conversation
…on create model - Add `schemas/validators.py` with `DepthIntervalMixin` for logical depth checks, `GeometryMixin` for WKT validation, and `validate_enum_input` for validation. - Add `CreateThingGeologicFormationAssociation` to `schemas_geologic_formation.py` to support creation of formation picks/stratigraphy. - Update `CreateGeologicFormation` to enforce uppercase formation codes and validate WKT boundaries. - Update `CreateAquiferSystem` to validate WKT boundaries.
- Delegate WKT boundary validation to `services/validation/geospatial.py` to enforce topological validity. - Update `CreateAquiferSystem` and `CreateGeologicFormation` to enforce strict Enum typing for controlled vocabularies, removing loose string coercion.
`top_depth` and `bottom_depth` are required so the None check is redundant. Remove the None check.
- Remove manual `if` validation logic for non-negative depths in `DepthIntervalMixin`. - Implement `Field(ge=0)` on `top_depth` and `bottom_depth` to leverage Pydantic's native schema validation and cleaner OpenAPI generation. - Ensure `CreateThingGeologicFormationAssociation` inherits these constraints by explicitly redefining fields with `ge=0`.
jacob-a-brown
approved these changes
Dec 2, 2025
…chema-validations # Conflicts: # schemas/aquifer_system.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
This PR addresses the following problem / context:
How
Implementation summary - the following was changed / added / removed:
New Validators Module: Created schemas/validators.py containing reusable mixins:
- DepthIntervalMixin: Enforces that bottom_depth > top_depth and depths are non-negative.
- GeometryMixin: Validates boundary fields
- validate_enum_input: A helper function to validate inputs against Enums case-insensitively.
Geologic Formations:
Aquifer Systems:
Notes
Any special considerations, workarounds, or follow-up work to note?