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

[PoC] - Datx types generator #43

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft

[PoC] - Datx types generator #43

wants to merge 1 commit into from

Conversation

isBatak
Copy link
Contributor

@isBatak isBatak commented Dec 7, 2022

Summary

This is a PoC of JSON:API types generator for Datx models.
It will take all of the Datx models and generate JSON:API model types under __generated__/types.ts.

Todo:

  • detect all Attribute decorator arguments (map, parse, strinigify, ...)
  • generate Document types
  • generate CompoundDocument types
  • generate links types (top-level, resource, relationship)
  • generate meta types
  • generate types based on OpenApi specification
  • tests
  • extract to separate package

@isBatak isBatak changed the base branch from master to strict-true December 7, 2022 10:27
.filter(
(node) =>
node.decorators[0].expression.arguments[0]?.properties[0].key.name === 'toOne' ||
node.decorators[0].expression.arguments[0]?.properties[0].key.name === 'toMany'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: loop through all the attributes, not just the first one [0]

Base automatically changed from strict-true to master December 7, 2022 12:53
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

Successfully merging this pull request may close these issues.

1 participant