Skip to content

Commit c53e139

Browse files
committed
fix
1 parent d05b7e4 commit c53e139

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

packages/py-moose-lib/moose_lib/internal.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,8 @@ class IngestApiConfig(BaseModel):
292292
version: Optional version string of the API configuration.
293293
path: Optional custom path for the ingestion endpoint.
294294
metadata: Optional metadata for the API.
295+
allow_extra_fields: Whether this API allows extra fields beyond the defined columns.
296+
When true, extra fields in payloads are passed through to streaming functions.
295297
"""
296298
model_config = model_config
297299

@@ -303,6 +305,7 @@ class IngestApiConfig(BaseModel):
303305
path: Optional[str] = None
304306
metadata: Optional[dict] = None
305307
json_schema: dict[str, Any] = Field(serialization_alias="schema")
308+
allow_extra_fields: bool = False
306309

307310

308311
class InternalApiConfig(BaseModel):
@@ -786,6 +789,10 @@ def to_infra_map() -> dict:
786789
)
787790

788791
for name, api in get_ingest_apis().items():
792+
# Check if the Pydantic model allows extra fields (extra='allow')
793+
# This is the Python equivalent of TypeScript's index signatures
794+
model_allows_extra = api._t.model_config.get("extra") == "allow"
795+
789796
ingest_apis[name] = IngestApiConfig(
790797
name=name,
791798
columns=_to_columns(api._t),
@@ -799,7 +806,8 @@ def to_infra_map() -> dict:
799806
json_schema=api._t.model_json_schema(
800807
ref_template='#/components/schemas/{model}'
801808
),
802-
dead_letter_queue=api.config.dead_letter_queue.name if api.config.dead_letter_queue else None
809+
dead_letter_queue=api.config.dead_letter_queue.name if api.config.dead_letter_queue else None,
810+
allow_extra_fields=model_allows_extra,
803811
)
804812

805813
for name, api in get_apis().items():

0 commit comments

Comments
 (0)