Skip to content
This repository was archived by the owner on Aug 7, 2025. It is now read-only.

Conversation

@cesarcajas
Copy link
Collaborator

schemas to validate gsma responses

@cesarcajas cesarcajas requested a review from adrian-pino August 5, 2025 11:46
@adrian-pino adrian-pino requested a review from Copilot August 5, 2025 12:38
Copy link
Contributor

Copilot AI left a 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(),
Copy link

Copilot AI Aug 5, 2025

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.

Suggested change
content=validated_data.model_dump_json(),
content=validated_data.model_dump(),

Copilot uses AI. Check for mistakes.
raise ValueError(f"Invalid schema: {e}")
return build_custom_http_response(
status_code=200,
content=validated_data.model_dump_json(),
Copy link

Copilot AI Aug 5, 2025

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.

Suggested change
content=validated_data.model_dump_json(),
content=validated_data.model_dump(),

Copilot uses AI. Check for mistakes.
raise ValueError(f"Invalid schema: {e}")
return build_custom_http_response(
status_code=200,
content=validated_data.model_dump_json(),
Copy link

Copilot AI Aug 5, 2025

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.

Suggested change
content=validated_data.model_dump_json(),
content=validated_data.model_dump(),

Copilot uses AI. Check for mistakes.
Comment on lines +892 to +898
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(),
Copy link

Copilot AI Aug 5, 2025

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.

Copilot uses AI. Check for mistakes.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Collaborator

@adrian-pino adrian-pino left a 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

@adrian-pino adrian-pino merged commit f0a077f into main Aug 5, 2025
2 checks passed
@adrian-pino adrian-pino deleted the feature/add-gsma-schemas-to-edgecloud-adapters branch August 5, 2025 13:28
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants