mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-28 04:52:07 +00:00
* stash some changes * add more robust testing * mypy * point PR at V5 * introduce spec file * codespell * test fix * fix workflow environment setup * fix workflow environment setup * fix workflow environment setup * add pyyaml to dependencies * split lint jobs * fix workflow environment setup * fix workflow environment setup * workflow env setup * workflow env setup * clean up code comments * add auth hook entrypoints * codespell * add codegen feature * codespell * move _unpack into dispatchers for consistency with codegen packages * surface nested models in the response * fix missing coverage in CI * socrata updates * test fix * detect plotly output * add --include and --exclude flags from generate-extension command * cap test matrix at python 3.14 * no useless comments * platform controller command description split * merge URL overloads from path params * exclude none and unset from model dump --------- Co-authored-by: deeleeramone <> Co-authored-by: Copilot <copilot@github.com>
43 lines
1.0 KiB
Python
43 lines
1.0 KiB
Python
"""Wire-format models for the NDJSON dispatcher protocol."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from typing import Any
|
|
|
|
from pydantic import BaseModel, ConfigDict, Field
|
|
|
|
|
|
class Request(BaseModel):
|
|
"""One request line on the NDJSON stream."""
|
|
|
|
model_config = ConfigDict(extra="forbid")
|
|
|
|
id: str | None = Field(
|
|
default=None,
|
|
description="Opaque correlation id echoed on the response. Generated client-side.",
|
|
)
|
|
command: str = Field(
|
|
description="Dotted command path, e.g. 'economy.gdp' or 'equity.price.historical'.",
|
|
)
|
|
params: dict[str, Any] = Field(default_factory=dict)
|
|
|
|
|
|
class ResponseError(BaseModel):
|
|
"""Structured error attached to a failed Response."""
|
|
|
|
model_config = ConfigDict(extra="forbid")
|
|
|
|
type: str
|
|
message: str
|
|
|
|
|
|
class Response(BaseModel):
|
|
"""One response line on the NDJSON stream."""
|
|
|
|
model_config = ConfigDict(extra="forbid")
|
|
|
|
id: str | None = None
|
|
ok: bool
|
|
result: Any = None
|
|
error: ResponseError | None = None
|