Skip to content

Feature/openapi python client wrappers#4

Merged
harell merged 8 commits intomasterfrom
feature/openapi-python-client-wrappers
Sep 25, 2025
Merged

Feature/openapi python client wrappers#4
harell merged 8 commits intomasterfrom
feature/openapi-python-client-wrappers

Conversation

@harell
Copy link
Contributor

@harell harell commented Sep 24, 2025

No description provided.

Copilot AI review requested due to automatic review settings September 24, 2025 22:40
Copy link

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 a comprehensive OpenAPI-generated Python client for the Templafy API, replacing the existing simple models with fully-featured client wrappers. The change represents a complete overhaul from basic HTTP client operations to a structured OpenAPI client implementation.

Key Changes:

  • Model System Replacement: Replaced simple placeholder model classes with auto-generated OpenAPI models using the attrs library for data validation and serialization
  • Client Architecture Overhaul: Completely restructured the client architecture to use attrs-based clients with proper async support and configuration management
  • API Endpoint Generation: Generated comprehensive API endpoint modules with both synchronous and asynchronous functions for all supported operations

Reviewed Changes

Copilot reviewed 116 out of 454 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/templafy/models/init.py Replaced simple model classes with comprehensive OpenAPI model imports and exports
src/templafy/errors.py Simplified error handling to use UnexpectedStatus exception pattern
src/templafy/client.py Complete rewrite using attrs-based Client and AuthenticatedClient classes with async support
src/templafy/models/color_theme_field_schema.py New OpenAPI model with attrs decorators for color theme field schema
src/templafy/api//.py Generated API endpoint modules with sync/async functions for CRUD operations across all resource types

Comment on lines +30 to +40

headers["Content-Type"] = "application/json-patch+json"
if isinstance(body, CreateLinkRequest):
_kwargs["json"] = body.to_dict()

headers["Content-Type"] = "application/json"
if isinstance(body, CreateLinkRequest):
_kwargs["json"] = body.to_dict()

headers["Content-Type"] = "application/*+json"

Copy link

Copilot AI Sep 24, 2025

Choose a reason for hiding this comment

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

Duplicate code blocks with identical isinstance checks but different Content-Type headers. This creates redundant assignments where the same _kwargs['json'] is set three times and headers['Content-Type'] is overwritten. Consider consolidating into a single block or using a more appropriate pattern to handle multiple content types.

Suggested change
headers["Content-Type"] = "application/json-patch+json"
if isinstance(body, CreateLinkRequest):
_kwargs["json"] = body.to_dict()
headers["Content-Type"] = "application/json"
if isinstance(body, CreateLinkRequest):
_kwargs["json"] = body.to_dict()
headers["Content-Type"] = "application/*+json"
headers["Content-Type"] = "application/json"

Copilot uses AI. Check for mistakes.
Comment on lines +124 to +125
body (CreateLinkRequest): The request model to create a link asset
body (CreateLinkRequest): The request model to create a link asset
Copy link

Copilot AI Sep 24, 2025

Choose a reason for hiding this comment

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

Duplicate documentation entries for the body parameter. The docstring should contain only one entry per parameter.

Suggested change
body (CreateLinkRequest): The request model to create a link asset
body (CreateLinkRequest): The request model to create a link asset

Copilot uses AI. Check for mistakes.
@t-t-sonarqube
Copy link

t-t-sonarqube bot commented Sep 25, 2025

Failed Quality Gate failed

  • 0.50% Coverage on New Code (is less than 80.00%)
  • 33.82% Duplicated Lines (%) on New Code (is greater than 3.00%)
  • 180 New Issues (is greater than 0)

Project ID: tonkintaylor_templafy_433f7948-2868-4177-b69d-87f581ddd5ff

View in SonarQube

@harell harell merged commit 476fadf into master Sep 25, 2025
27 of 29 checks passed
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