Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement class-based API for graph declaration #142

Open
3 of 22 tasks
skovbasa opened this issue Oct 23, 2023 · 0 comments
Open
3 of 22 tasks

Implement class-based API for graph declaration #142

skovbasa opened this issue Oct 23, 2023 · 0 comments

Comments

@skovbasa
Copy link
Collaborator

Implement and process class-based graph components. Old and new apis have to coexist to enable gradual migration.

  • field as a function returning field context.
  • field_link as a function returning link context.
  • Node through either a base class or a class decorator.
    • Add default resolvers for field and field_link.
    • Transform field and link names to camelCase automatically. Support name overriding.
    • Add types from annotations to fields and links.
      • Process default scalar types (int, float, str, bool, optional, list).
      • Process Node types. Maybe add link[Node] for a future.
      • Process custom scalar types.
      • Process interfaces.
      • Process unions.
      • Process enums.
    • Transform class-based Node to a regular one at graph initialization.
  • Interface through either a base class or a class decorator.
    • No support for resolvers.
    • Transform class-based Interface to a regular one at graph initialization.
  • Union as typing.Annotated[Node1 | Node2 | Node3, hiku.union('UnionName')].
    • Transform class-based Union to a regular one at graph initialization.
  • Directive unchanged.
  • Option unchanged.
  • Enum unchanged.
  • Lazy resolve Node types with typing.Annotated['Node1', hiku.lazy('.some_node')].
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant