Skip to content

Instantly share code, notes, and snippets.

View jerber's full-sized avatar

Jeremy Berman jerber

View GitHub Profile
@jerber
jerber / pydantic_to_strawberry.py
Last active February 1, 2022 21:38
Getting Strawberry to work with nested Pydantic Models
from __future__ import annotations
import typing as T
from enum import Enum
from pydantic import BaseModel
from pydantic.fields import ModelField
import strawberry
from strawberry.field import StrawberryField
from strawberry.types.types import TypeDefinition