Skip to content

report: align OpenAPI schemas with actual API responses and introduce DTO service contracts#342

Open
ol-zayatsm wants to merge 2 commits into
ts-factory:mainfrom
ol-zayatsm:reports_swagger_update
Open

report: align OpenAPI schemas with actual API responses and introduce DTO service contracts#342
ol-zayatsm wants to merge 2 commits into
ts-factory:mainfrom
ol-zayatsm:reports_swagger_update

Conversation

@ol-zayatsm

@ol-zayatsm ol-zayatsm commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Description

Summary

Update API v2 OpenAPI schema definitions for report endpoints and introduce
DTOs for report service responses to keep API documentation and service-layer
contracts aligned with current response payloads.

Changes

  • Add schema for the GET /report/{run_id}/configs endpoint.
  • Add schema for the GET /report/{run_id} endpoint.
  • Document the required config query parameter for report generation.
  • Add serializers for report configuration, generated report, and
    unprocessed iterations.
  • Add DTOs for report configurations, generated reports, and unprocessed
    iterations.
  • Return DTOs from report service methods instead of dictionaries and tuples.
  • Serialize DTO-backed service responses in report endpoints.
  • Document success (200) and error (400, 404) responses.
  • Keep OpenAPI definitions aligned with the current report service API.

Replace dict-based service responses with typed DTOs to introduce
explicit and structured data contracts across service boundaries and
move serialization to API boundary to improve separation of
concerns between service layer and API layers.

Signed-off-by: Mikhail Zayats <mikhail.zayats@oktetlabs.ru>
@ol-zayatsm ol-zayatsm force-pushed the reports_swagger_update branch from b4b7391 to 725b522 Compare July 4, 2026 16:18
@ol-zayatsm ol-zayatsm changed the title report: align OpenAPI schemas with actual API responses report: align OpenAPI schemas with actual API responses and introduce DTO service contracts Jul 4, 2026
response=ReportConfigListResponseSerializer,
description='Configurations were successfully retrieved',
),
},

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Missing 404 — self.get_object() can raise it if run_id doesn't exist.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

class ReportRetrieveResponseSerializer(serializers.Serializer):
warnings = serializers.ListField(child=serializers.CharField())
config = ReportConfigSerializer()
content = serializers.ListField(child=serializers.DictField())

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

content has a fully known 4-level structure (test → args-vals → measurement → record), each with fixed fields — DictField() loses all of it in the generated schema. Consider proper nested serializers for all four levels.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

@ol-zayatsm ol-zayatsm marked this pull request as ready for review July 7, 2026 19:54
Ensure consistency between OpenAPI schemas and API responses by
introducing explicit request/response serializers and binding them via
drf-spectacular.

Signed-off-by: Mikhail Zayats <mikhail.zayats@oktetlabs.ru>
@ol-zayatsm ol-zayatsm force-pushed the reports_swagger_update branch from 725b522 to 35826d7 Compare July 8, 2026 19:47
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