Giter Site home page Giter Site logo

Comments (2)

mjpieters avatar mjpieters commented on September 21, 2024

Unfortunately, using typing.ForwardRef() can't be used as a suitable replacement, as jsons._common_impl.get_class_name() can't handle forward references:

>>> from typing import ForwardRef
>>> from jsons._common_impl import get_class_name
>>> get_class_name(ForwardRef("module.FooBar"))
"FooBar')"

I may have misunderstood what kind of registrations set_deserializer accepts; I've registered a Dict[str, "module.ObjectType"] deserializer before, where this deserializer was successfully matched against a dataclass with a matching Dict[str, ObjectType] field (note the forward reference in the registration and the lack of such a reference in the concrete object; Python passes in a Dict[str, ForwardRef('module.ObjectType')] object to set_deserializer in that case, but I suspect now that only typing.Dict is being registered in that case and so I got lucky.

from jsons.

mjpieters avatar mjpieters commented on September 21, 2024

I indeed misunderstood, and currently the use-cases I had in mind won't work with jsons (yet). This bug report is not a valid one with the currently supported feature-set so I'm closing this.

from jsons.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.