PromptVersion.published_at is generated as a required, non-nullable datetime, but the field is null for any version that was never set to live. Its own description says so ("Timestamp when status was set to live. Null if draft."). When the server returns published_at: null, PromptVersion.from_dict raises a pydantic ValidationError, so the SDK cannot deserialize a version unless its status is live.
Reproduction
from px0.models.prompt_version import PromptVersion
PromptVersion.from_dict({
"id": "ver_1",
"prompt_id": "prm_1",
"version": 1,
"template": "Hello {{.name}}!",
"status": "draft",
"created_at": "2024-01-01T00:00:00Z",
"published_at": None,
"tags": [],
})
pydantic_core._pydantic_core.ValidationError: 1 validation error for PromptVersion
published_at
Input should be a valid datetime [type=datetime_type, input_value=None, input_type=NoneType]
Impact
published_at is null for every version that is not currently live (draft, stable, archived). Because the wrapper models embed PromptVersion, this breaks the endpoints that return versions:
create_version returns a draft, so its own response cannot be parsed.
promote_version (draft -> stable) returns a version that was never live.
duplicate_version returns a draft.
get_version / archive_version on any non-live version.
list_versions fails entirely if a single element is non-live, since ListVersions200Response.versions is List[PromptVersion].
Root cause and fix
The response schema marks published_at required and non-nullable. APIKey.last_used_at has the same "Null if never used" semantics and is correctly Optional[datetime] = None, which is the shape published_at should have. In the OpenAPI document, published_at should be nullable: true and dropped from the schema's required list; the generator then emits Optional[datetime] = None.
I have a PR that applies the equivalent change to the generated model and doc, with regression tests.
PromptVersion.published_atis generated as a required, non-nullabledatetime, but the field is null for any version that was never set tolive. Its own description says so ("Timestamp when status was set to live. Null if draft."). When the server returnspublished_at: null,PromptVersion.from_dictraises a pydanticValidationError, so the SDK cannot deserialize a version unless its status islive.Reproduction
Impact
published_atis null for every version that is not currentlylive(draft, stable, archived). Because the wrapper models embedPromptVersion, this breaks the endpoints that return versions:create_versionreturns a draft, so its own response cannot be parsed.promote_version(draft -> stable) returns a version that was never live.duplicate_versionreturns a draft.get_version/archive_versionon any non-live version.list_versionsfails entirely if a single element is non-live, sinceListVersions200Response.versionsisList[PromptVersion].Root cause and fix
The response schema marks
published_atrequired and non-nullable.APIKey.last_used_athas the same "Null if never used" semantics and is correctlyOptional[datetime] = None, which is the shapepublished_atshould have. In the OpenAPI document,published_atshould benullable: trueand dropped from the schema'srequiredlist; the generator then emitsOptional[datetime] = None.I have a PR that applies the equivalent change to the generated model and doc, with regression tests.