refactor: add generic type parameters for improved type flexibility #91
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
TLDR
Added generic type parameters to API key, override, and document schemas for better type flexibility.
Change Summary
Code Changes:
In
src/typesense/types/key.py
:_ActionT
type variable with bounds for API key action type constraintsApiKeyCreateSchema
,ApiKeyCreateResponseSchema
,ApiKeySchema
, andApiKeyRetrieveSchema
generic with_ActionT
parameterApiKeyCreateSchemaCompat
,ApiKeySchemaCompat
, etc.)_Actions
union type with generic_ActionT
parameter in actions fieldIn
src/typesense/types/override.py
:_OverrideRuleT
type variable for override rule type constraintsOverrideCreateSchema
andOverrideSchema
generic with_OverrideRuleT
parameterOverrideCreateSchemaCompat
,OverrideSchemaCompat
)In
src/typesense/types/document.py
:_DocumentImportParamsT
,_ImportResponseT
, and_StringOrListT
type variablesDocumentImportParametersGeneric
type variable for document import parametersIn
src/typesense/__init__.py
:1.2.0
to1.2.1
Context
#90
PR Checklist