fix(ci): fix black/ruff failures, add CoC and PR template
- Fix Python formatting (sync no longer strips blank lines from .py files) - Remove test_community_build.py (tests private sync module) - Fix ruff warnings in test files - Add CODE_OF_CONDUCT.md - Add .github/PULL_REQUEST_TEMPLATE.md Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -6,6 +6,7 @@ Validation schemas for WordPress posts, pages, and custom post types.
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field, field_validator
|
||||
|
||||
|
||||
class PostBase(BaseModel):
|
||||
"""Base post schema with common fields"""
|
||||
|
||||
@@ -44,6 +45,7 @@ class PostBase(BaseModel):
|
||||
raise ValueError("Status must be 'open' or 'closed'")
|
||||
return v
|
||||
|
||||
|
||||
class PostCreate(PostBase):
|
||||
"""Schema for creating a new post"""
|
||||
|
||||
@@ -52,12 +54,14 @@ class PostCreate(PostBase):
|
||||
|
||||
model_config = ConfigDict(extra="allow")
|
||||
|
||||
|
||||
class PostUpdate(PostBase):
|
||||
"""Schema for updating an existing post"""
|
||||
|
||||
# All fields optional for updates
|
||||
pass
|
||||
|
||||
|
||||
class PostResponse(BaseModel):
|
||||
"""Schema for post response data"""
|
||||
|
||||
@@ -77,6 +81,7 @@ class PostResponse(BaseModel):
|
||||
categories: list[int]
|
||||
tags: list[int]
|
||||
|
||||
|
||||
class PageCreate(PostCreate):
|
||||
"""Schema for creating a new page"""
|
||||
|
||||
@@ -84,6 +89,7 @@ class PageCreate(PostCreate):
|
||||
menu_order: int | None = Field(None, description="Menu order")
|
||||
template: str | None = Field(None, description="Page template")
|
||||
|
||||
|
||||
class PageUpdate(PostUpdate):
|
||||
"""Schema for updating an existing page"""
|
||||
|
||||
@@ -91,11 +97,13 @@ class PageUpdate(PostUpdate):
|
||||
menu_order: int | None = Field(None, description="Menu order")
|
||||
template: str | None = Field(None, description="Page template")
|
||||
|
||||
|
||||
class CustomPostCreate(PostCreate):
|
||||
"""Schema for creating custom post types"""
|
||||
|
||||
post_type: str = Field(..., description="Custom post type")
|
||||
|
||||
|
||||
class CustomPostUpdate(PostUpdate):
|
||||
"""Schema for updating custom post types"""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user