-
-
Notifications
You must be signed in to change notification settings - Fork 502
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
Issue with "createFunction" when using embeddable property with hyphens #1958
Comments
That link is invalid, looks like the repo is not even there? I was fixing pretty much the same problem some time ago, it might as well be already fixed in master (v5) or in #1948. Or it is just a wrong entity definition. I'd say the property names itself cannot even contain hyphens (as that is not allowed at JS/TS level). What you can do is to have a |
Sorry updated the link and made my repo public. I tried the fieldName to be using hyphens but it was the same issue. |
Wow, never thought this is actually valid property definition. So you have tried this, right? @Embeddable()
export class SubModel {
@Property({ name: 'some-prop-with-hyphens', nullable: true })
somePropWithHyphens?: string;
} |
Yea tried that and it ended up with the same error |
So I did a bit more testing, the above you mentioned does work, I realized my real use case is that the property I'm trying to use hyphens with is using @Embedded , which does not have a fieldName option, I found a workaround in the meantime that I just introduced a function on my model that does the mapping |
So you have object embeddables, right? It should actually work to pass the |
Hey, how did you solved your issue? |
Describe the bug
This issues seems to be an issue with the create function. Maybe it could use bracket notation instead of dot notation? Please let me know if there's any work arounds that you can think of. I'm unable to change the name of the property in my situation. Not sure if this is specific to embeddable or entities as a whole.
Stack trace
To Reproduce
https://github.com/ryankauk/mikro-jest-global-setup/blob/master/src/index.spec.ts
test case "test embedded model with property and hyphens"
Expected behavior
I expect that you should be able to use hyphens in property name.
Additional context
Versions
The text was updated successfully, but these errors were encountered: