Open visko-sc opened 2 years ago
They are related. But while #187 brings a specific problem (str | None) and schema creation, this is about the pipe operator and data class creation error. The root cause is probably the same.
Adding from __future__ import annotations
at the top fixed the example code you posted.
Actual result: {'numbers': Numbers(roman='X')}
Expected result: {'numbers': {'roman': 'X'}}
I think the problem can be fixed in either _get_field_type_name or in https://github.com/s-knibbs/dataclasses-jsonschema/blob/648ada22bf0cb9f19b0ed12e1870844d854015b5/dataclasses_jsonschema/__init__.py#L391
Note: These work as expected: