Commit 4483636
Implement the remaining Audit Logs functionality (#515)
* Add the rest of the Audit Logs implementation
* Replace asyncio.iscoroutinefunction with inspect
Starting in Python 3.14, use of `asyncio.iscoroutinefunction` emits a
deprecation warning (c.f. python/cpython#122858). The recommendation is
to use inspect.iscoroutinefunction instead.
* Use 'schema' field and handle pydantic's warning
* Test sync and async variants propertly
* it's in now
* feat(audit-logs): Add typed inputs for create_schema
Introduces TypedDict definitions for the simplified schema input format:
- AuditLogSchemaTargetInput for target definitions
- AuditLogSchemaActorInput for actor definitions
- MetadataSchemaInput for metadata field type mappings
Also adds serialize_schema_options() to transform the simplified format
(e.g., {"status": "string"}) to the full JSON Schema format expected
by the API.
* refactor(audit-logs): Use typed inputs in create_schema
Replaces generic Mapping[str, Any] parameters with the new typed inputs.
Uses shared serialize_schema_options() function instead of inline JSON
building, reducing duplication between sync and async implementations.
* fix(audit-logs): Make optional fields nullable in response models
The API can return null for actor in AuditLogSchema (when no custom
metadata defined) and for retention_period_in_days in AuditLogRetention
(when not configured). Updated models to accept None.
* test(audit-logs): Update tests for simplified input format
Updates create_schema tests to use the new simplified input format and
verifies the serialization to full JSON Schema format. Adds edge case
tests for nullable fields (actor in schema, retention_period_in_days).
---------
Co-authored-by: Garen Torikian <gjtorikian@users.noreply.github.com>1 parent bf23a30 commit 4483636
File tree
13 files changed
+1340
-79
lines changed- src/workos
- types
- audit_logs
- tests
13 files changed
+1340
-79
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
| |||
0 commit comments