-
Notifications
You must be signed in to change notification settings - Fork 6
Feature/add gsma schemas to edgecloud adapters #161
Feature/add gsma schemas to edgecloud adapters #161
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces GSMA schema validation to edgecloud adapters by adding comprehensive schema definitions and implementing validation in the i2edge adapter. The change enhances data consistency and API compliance for GSMA federation APIs.
- Adds comprehensive GSMA schema definitions using Pydantic models for validation
- Updates edgecloud interface method signatures to align with GSMA standards
- Implements schema validation and response mapping in the i2edge adapter
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| src/sunrise6g_opensdk/edgecloud/core/gsma_schemas.py | Defines comprehensive GSMA schema models using Pydantic for validation |
| src/sunrise6g_opensdk/edgecloud/core/edgecloud_interface.py | Updates method signature to remove unused parameters from GSMA interface |
| src/sunrise6g_opensdk/edgecloud/adapters/kubernetes/client.py | Updates method signature and return type to match interface changes |
| src/sunrise6g_opensdk/edgecloud/adapters/i2edge/schemas.py | Adds mobilitySupport field to AppQoSProfile schema |
| src/sunrise6g_opensdk/edgecloud/adapters/i2edge/gsma_utils.py | Implements data mapping utilities for transforming raw data to GSMA format |
| src/sunrise6g_opensdk/edgecloud/adapters/i2edge/common.py | Replaces PUT with PATCH method and improves error handling |
| src/sunrise6g_opensdk/edgecloud/adapters/i2edge/client.py | Implements comprehensive GSMA schema validation and response mapping |
| src/sunrise6g_opensdk/edgecloud/adapters/aeros/client.py | Updates method signature to match interface changes |
| raise ValueError(f"Invalid schema: {e}") | ||
| return build_custom_http_response( | ||
| status_code=200, | ||
| content=validated_data.model_dump_json(), |
Copilot
AI
Aug 5, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The model_dump_json() method returns a JSON string, but the content should be a dictionary for proper HTTP response handling. Use validated_data.model_dump() instead.
| content=validated_data.model_dump_json(), | |
| content=validated_data.model_dump(), |
| raise ValueError(f"Invalid schema: {e}") | ||
| return build_custom_http_response( | ||
| status_code=200, | ||
| content=validated_data.model_dump_json(), |
Copilot
AI
Aug 5, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The model_dump_json() method returns a JSON string, but the content should be a dictionary for proper HTTP response handling. Use validated_data.model_dump() instead.
| content=validated_data.model_dump_json(), | |
| content=validated_data.model_dump(), |
| raise ValueError(f"Invalid schema: {e}") | ||
| return build_custom_http_response( | ||
| status_code=200, | ||
| content=validated_data.model_dump_json(), |
Copilot
AI
Aug 5, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The model_dump_json() method returns a JSON string, but the content should be a dictionary for proper HTTP response handling. Use validated_data.model_dump() instead.
| content=validated_data.model_dump_json(), | |
| content=validated_data.model_dump(), |
| try: | ||
| validated_data = gsma_schemas.Artefact.model_validate(content) | ||
| except ValidationError as e: | ||
| raise ValueError(f"Invalid schema: {e}") | ||
| return build_custom_http_response( | ||
| status_code=200, | ||
| content=content, | ||
| content=validated_data.model_dump_json(), |
Copilot
AI
Aug 5, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The variable content is already a gsma_schemas.Artefact instance, so calling model_validate on it is redundant. Remove this validation step or validate the raw data before creating the content object.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
adrian-pino
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MR accepted, to be revised the model_dump_json() copilot's suggested changes
schemas to validate gsma responses