-
Notifications
You must be signed in to change notification settings - Fork 20
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
feat: Create links from/to ExternalHash
#380
feat: Create links from/to ExternalHash
#380
Conversation
…folding a link-type
…-to-create-link-with-externalhash
3231d79
to
5d11459
Compare
…-to-create-link-with-externalhash
I noticed that the And as another remark, I think it might be worth adding |
It might even make sense to replace |
I'm not sure though...maybe there are cases where this flexibility is desired, i.e. that you'd want to allow for a link that can point to either of these types and is not hard-coded. So keeping |
Yes this
From my understanding of the previous code, I think the term optional doesn't really communicate the purpose correctly. I see that the |
I was actually torn between these, but it makes sense to be explicit in this case. |
AnyLinkableHash
ExternalHash
The You might argue that this use case could be done by targeting any other entry hash. But then the scaffolding tool would scaffold validation to make sure that the target entry exists, which is not what I want if I only want to attach metadata to that hash. Hope this helps! |
Oh interesting, yes this helps. Maybe this could be described a bit more clearly in the option then. Something like |
6d3c514
to
b534735
Compare
…-to-create-link-with-externalhash
...rom_referenceable.name}}-to-{{kebab_case (plural to_referenceable.name)}}.test.ts{{¡if}}.hbs
Outdated
Show resolved
Hide resolved
…-to-create-link-with-externalhash
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it looks good to me know. I did notice some things that I think should be addressed at some point but they can be addressed independently of this PR:
-
if you create a link type, the file name and function names have the target link in plural (I think this is because it uses the same naming logic as for collections where an anchor points to multiple entries). For example
validate_create_link_book_to_pages
instead ofvalidate_create_link_book_to_page
-
There is a general problem it seems that files can get overwritten in case of name collisions. This can happen most easily with meta-data-only links whose file names are single word names, e.g.
book.rs
if the link type is namedbook
. So in this case it would overwrite an existingbook.rs
file from a scaffoldedbook
entry-type. Or the other way around, whichever is scaffolded first.
Yes, I noticed an issue with the naming, will address it separately |
* add ExternalHash field types and option to target this type when scaffolding a link-type * ensure external hash is imported in type declarations * feat: create links from/to AnyLinkableHash * Add AnyLinkablehHash field type templates and add to reserved words * fix failed to resolve errors * improve checking for reserved keywords * fix invalid link-type delete method in test template * simplify reserved_words hashsets * update cli * Extend reserved keywords to check for javascript keywords * Update AnyLinkableHash sample value * Extend reserved words check tests * fix AnyLinkableHash link-type tests * Fix AnyLinkableHash link-type tests and remove redundant AND/OR hbs helpers * update inner_choose_referenceable * /AnyLinkableHash/ExternalHash * Update invalid serserved word error message * Refactor entry/link type utils * Add some context to the [None] option when scaffolding a link-type * /AnyLinkableHash/ExternalHash in link-type template * Fix option placement * Prevent UI from getting generated where the base type of a link is an ExternalHash * ExternalHash links can be bidirectional * Only skip ui if to_referenceable is some and the field_type is of ExternalHash * Remove unnecessary into call in delete link function * Fix rustfmt ci failure * Fix missing conversion * Fix react link-type template
* Bump crate version * feat: Create links from/to `ExternalHash` (#380) * add ExternalHash field types and option to target this type when scaffolding a link-type * ensure external hash is imported in type declarations * feat: create links from/to AnyLinkableHash * Add AnyLinkablehHash field type templates and add to reserved words * fix failed to resolve errors * improve checking for reserved keywords * fix invalid link-type delete method in test template * simplify reserved_words hashsets * update cli * Extend reserved keywords to check for javascript keywords * Update AnyLinkableHash sample value * Extend reserved words check tests * fix AnyLinkableHash link-type tests * Fix AnyLinkableHash link-type tests and remove redundant AND/OR hbs helpers * update inner_choose_referenceable * /AnyLinkableHash/ExternalHash * Update invalid serserved word error message * Refactor entry/link type utils * Add some context to the [None] option when scaffolding a link-type * /AnyLinkableHash/ExternalHash in link-type template * Fix option placement * Prevent UI from getting generated where the base type of a link is an ExternalHash * ExternalHash links can be bidirectional * Only skip ui if to_referenceable is some and the field_type is of ExternalHash * Remove unnecessary into call in delete link function * Fix rustfmt ci failure * Fix missing conversion * Fix react link-type template * feat: Improve `hc-scaffold entry-type` developer experience (#383) * refactor enum type selection; add option to restart field type selection; refactor FieldType parsing * Improve EntryTypeReference parsing * Improve parse_enum parsing logic * Update field_type parsing logic * fix: Optimize nix flake (#384) * optimize nix flake * Supress clippy warnings * Nix flake update
Closes #254
Closes #389