Skip to content

Feature/expand validation pydantic models 3d api#33

Open
javlor wants to merge 4 commits into
mainfrom
feature/expand-validation-pydantic-models-3d-API
Open

Feature/expand validation pydantic models 3d api#33
javlor wants to merge 4 commits into
mainfrom
feature/expand-validation-pydantic-models-3d-API

Conversation

@javlor

@javlor javlor commented Jul 20, 2026

Copy link
Copy Markdown
Collaborator

Extend 3D API Pydantic models with contract-compatible validation and optional fields:

  • Tracker.tracker_rotation_id and tracker_system_id are optional
  • Optimizer IDs enforce min_length=1, and optimizer configurations require fixed_voltage_from_inverter.
  • IndexedObject3D.is_building defaults to False; name defaults to None.
  • Module and terrain index/dimension fields now reject negative values.
  • dc_ohmic_connector_resistance now enforces the API maximum of 10.

Additionally, fix an integration test for the About endpoint for the deprecated API v4.

@javlor
javlor requested a review from wholmgren-dnv July 20, 2026 10:31

@wholmgren wholmgren left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

agent discovered a new issue when trying to do a round trip test with the Matera data: TrackerSystem.east_west_gcr needs an alias to map onto the correct SF property. Recommend an integration test to ensure 3d pydantic models serialize into known working json.

east_west_gcr: float | None = Field(None, alias="eastWestGCR")

raise ValueError(
"fixed_voltage_from_inverter is required when power optimizers are configured"
)
if self.dc_ohmic_connector_resistance is not None and self.dc_ohmic_connector_loss != 0.0:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

is this pre-existing block more strict than sf-core validation and should be removed? the new block and pydantic limits are sufficient?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This is a new validation check for API v7 (in the upcoming release) that originated from a couple of support issues recently. For those using the SDK, it gets validated it. Those using their own code, the validation service will catch it.

…3D pydantic model to serialize into sample Matera tutorial 3D payload.
@javlor

javlor commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator Author

TrackerSystem.east_west_gcr needs an alias to map onto the correct SF property. Recommend an integration test to ensure 3d pydantic models serialize into known working json.

@wholmgren thanks for the comments. I have committed the changes for this issue. Explicit alias eastWestGCR helps match the API schema rather than the auto-generated camelCase alias eastWestGcr. I have added a test to check the serialization against the Matera tutorial files.

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