Skip to content

Instantly share code, notes, and snippets.

@shaungehring
Created February 5, 2020 14:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shaungehring/8482b87209c053335178230175523c05 to your computer and use it in GitHub Desktop.
Save shaungehring/8482b87209c053335178230175523c05 to your computer and use it in GitHub Desktop.
@dataclass
class BoundaryGeneric:
def __init__(self, child_name, kwargs=None):
self.typename = child_name
if kwargs:
self.update_class(kwargs)
self.get_updated()
def update_class(self, kwargs):
for k, v in kwargs.items():
if not hasattr(self, k):
setattr(self, k, v)
def get_updated(self):
return self
"""
Dataclasses, These need to be defined for Boundry Types (A GraphQL type from another server that you are Extending
"""
@dataclass
class User(BoundaryGeneric):
def __init__(self, **kwargs):
super().__init__(self.__class__.__name__, kwargs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment