Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Serialization/Deserialization doesn't handle Generics and generates Non-deterministic workflow error

Aperta
#572 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
48/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Tranquilla
Stack tecnologico
python
Ambito
backend

Direzione di ricerca

Inizia tracciando azure.functions._durable_functions._serialize_custom_object e _deserialize_custom_object usando l'esempio Pydantic Generic nell'issue. Riproduci il flusso da activity a orchestrator e verifica come viene serializzato e cercato il nome della classe generica. Il lavoro è completato quando l'esempio viene deserializzato correttamente senza AttributeError né un errore di workflow non deterministico.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug fixed-in-v2 P2

🐛 Describe the bug
When a Pydantic Generic object is returned in an activity function azure.functions._durable_functions._serialize_custom_object returns "class": "ClassName[GenericSpecificClass]". When azure.functions._durable_functions._deserialize_custom_object is called in the calling orchestrator, getattr(module, "ClassName[GenericSpecificClass]") fails: ClassName exists but not the specialized "ClassName[GenericSpecificClass]".

🤔 Expected behavior
Serialization and deserialization handles Generics.

Current behaviour
Deserialization fails with AttributeError: module 'xxx.xxx' has not attribute 'ClassName[GenericSpecificClass]'and produces a Non-Deterministic Workflow error

☕ Steps to reproduce

from pydantic import BaseModel
from typing import Generic
import azure.functions as func
import azure.durable_functions as df

class A(BaseModel, Generic[T]):
    a: T

    def to_json():
        return self.model_dump(mode="json")

    @classmethod
    def from_json(cls, data: dict):
        return cls(**data)



myApp = df.DFApp(http_auth_level=func.AuthLevel.ANONYMOUS)

@myApp.orchestration_trigger(context_name="context")
def orchestrator_function(context: df.DurableOrchestrationContext):
    x = yield context.call_activity("hello", None)

@myApp.activity_trigger(input_name="params")
def hello(params):
    return A[str](a="xxx")

Lingua principale
Python
Stelle
157
Fork
70
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di Azure/azure-functions-durable-python

Tutte le issue di Azure/azure-functions-durable-python

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.