#`currentFunctionCall().parentName()`
1 messages · Page 1 of 1 (latest)
If it's empty you're supposed to return the ModuleID with your module's type definitions. If it's not empty it will be a type that your module registered. Depends on what you created with moduleDef.withObject(...).
so it's the type name? In my case it seemed to be all lower case which is why I was having doubts
Yes. Did you register them with lower case? The engine preserves the "original name" in several places so it's possible that you register with lower case, the engine converts to PascalCase when extending the schema, but uses the original lower case value when you use currentFunctionCall().
@oblique bay I registered the main object with currentModule().Name(), because I saw another runtime do it that way. I guess that's all lowercase? Is it the correct way to do it? Should I manually capitalize the first character?
The engine will convert it for you so you're not strictly required but it can be confusing when debugging, depending on what you're exposing.
yeah it's confusing
Does the engine set currentFunctionCall().parentName() to exactly the type name that I registered?
It stores two versions of it. The one that’s passed around throughout the system is converted and is what ends up in the schema. The other is usually called originalName. It’s untouched and used when talking back to your module only. This pattern exists all over, when you register something with a name.
The goal with it was to avoid putting the responsibility on sdk maintainers to make sure casing is properly converted in several places.