Skip to content

Commit 911d734

Browse files
fern-supporttjb9dc
andauthored
Fix PydanticUserError due to missing discriminator field (#62)
* repro test * fix --------- Co-authored-by: Thomas Baker <[email protected]>
1 parent 4c639f8 commit 911d734

File tree

5 files changed

+18
-8
lines changed

5 files changed

+18
-8
lines changed

.fernignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
# Specify files that shouldn't be modified by Fern
22
README.md
33
credal-dark-logo.svg
4+
5+
tests/custom/

src/credal/copilots/types/filter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,5 +78,5 @@ class Config:
7878

7979
Filter = typing_extensions.Annotated[
8080
typing.Union[Filter_String, Filter_Number, Filter_Boolean, Filter_Datetime],
81-
pydantic.Field(discriminator="fieldType"),
81+
pydantic.Field(discriminator="field_type"),
8282
]

tests/custom/__init__.py

Whitespace-only changes.

tests/custom/test_client.py

Lines changed: 0 additions & 7 deletions
This file was deleted.

tests/custom/test_verify_types.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
from credal import CredalApi
2+
3+
def test_services_can_be_imported() -> None:
4+
client = CredalApi(api_key="")
5+
assert client.copilots is not None
6+
assert client.document_catalog is not None
7+
assert client.document_collections is not None
8+
assert client.search is not None
9+
assert client.users is not None
10+
11+
# Assert that the number of top-level properties of the CredalApi instance is fixed
12+
# This can help ensure the API surface is not unexpectedly changed
13+
# If this changes, we just need to update our service assertions
14+
services = {attr for attr in dir(client) if not attr.startswith("_") and not callable(getattr(client, attr, None))}
15+
assert len(services) == 5

0 commit comments

Comments
 (0)