-
Notifications
You must be signed in to change notification settings - Fork 14
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
TypeScriptInterfaceMethods.tpl generating non-matching camel case structure references in method interfaces. #321
Comments
Hey, Tom. Before I spend too much time on this, can you check something out for me. This is a "delicate" area, as we have had different customers wanting different behaviors, and I want to avoid fixing something specifically for you and in the process breaking it for someone else. Generally, when processing with the method catalog, names are maintained from exactly how they appear in the method catalog, which has case-sensitive names. There are a couple of CodeGen "tweaks" which allow you to morph these interface, method and parameter names into camelCase or PascalCase, when using the UPPER case replacement tokensm like <INTERFACE_NAME>, <METHOD_NAME> and <PARAMETER_NAME>. The tweaks are SMC_CAMEL_CASE and SMC_PASCAL_CASE. You would use one of them via the -tweaks <tweak_name> command line option, for example -tweaks SMC_CAMEL_CASE. Tweaks are documented here: https://codegen.synergex.com/topics/tweaks.htm Can you try these out and see if one of them addresses your issue? |
Hi Steve. I will test that out. Thank you for the references to the tweaks...I was trying to figure those out from within the HC project and couldn't find how those were handled....I failed to be look inside the CodeGen project...probably why I missed the documentation on it. So while I was waiting, I actually modified the TyperScript templates to make it do what we wanted. I have attached those for review. I noticed the Non-Tweaked version didn't really match up the casing like I thought it would and it also applied pluralization where I didn't expect it to, causing some undefined references. The attach file has the template modifications that get's us all the way to the finish in our Angular implementation. I will test out the Tweak modifications and see how those work and post feedback to this question. Thanks again. |
@hippiehunter how would I implement those tweaks in the harmonycore gui? (I only found reference to those in regen.bat when I searched for it.) |
I think these typescript files are being generated by your csx script file. I think there is a task coming from InterfaceTaskHelper. CodeGenTask has a ObservableCollection member on it for Tweaks The Tweaks Steve is referencing above can just be added to that Collection on the CodeGenTask being created in your csx file. |
Thanks Jeff. I will see about doing a run through on those and see if that address the casing issues I was seeing. |
@tscaff did this solve your problem? |
@hippiehunter I did a few tests using the tweak options and it doesn't quite hit the mark in the manner I was hoping. It seems to tweak the value opposite of what they should be. I have to use my original template modifications I posted earlier to make it work. Example: If I set SMC_PASCAL_CASE on both the structures and methods and client code, it seems to camel case the structure names and shows as undefine, such as in this case where abaFile is camel cased, but it's value in structures is pascal cased. When I set SMC_CAMEL_CASE it seems to do the opposite problem. And this is with using the existing templates so I guess I don't see how these could be working for folks. import * as WeblibStructures from '../interfaces/Structures'; export interface AbalookupRequest {
Stucture: ABA_FILE Maybe I am doing these wrong? I have attached the templats and files for review. |
I poked around in the tpl files and checked with steve, the tweaks stuff is only supposed to apply to all caps tokens. As an example from one of the tpl files
those tokens will give you camel case and should be ignoring tweaks settings.
These tokens will give you exact case (whatever was specified in the SMC) but will respond to tweaks settings. You can either change the tokens to all caps and set the tweaks or just adjust the casing in the tokens to the type you're looking for. |
@tscaff do you have a working solution to this problem? |
Hi @hippiehunter I just got back to looking at this. I don't have a solution to this problem yet. I may need some help working this one out. |
When generating TypeScript templates in Harmony Core, it looks like the camel casing for the structure names in the methods template are incorrect and do not match the casing of the Structures being generated.
Is there a different token than <PARAMETER_TSTYPE> that will provide the correct casing of the structure name?
Example: Note the casing on the weblibStructures.abaFile reference which does not match the casing of the structure in the Structures.ts generated by the codegen tool.
import * as weblibStructures from './Structures';
// ------------------------------------------------------------------------------
// Operation: ABALookup
export interface ABALookupRequest {
connectionString: string;
abaFileRecord: weblibStructures.abaFile;
lookupType: string;
abaCount: number;
}
Stucture: ABA_FILE
Description: ABA Bank Index File
/
export interface AbaFile {
AbaNumber: number; / Size: 9, Description: ABA Bank Number /
AbaName: string; / Size: 36, Description: ABA Bank Name /
AbaShortname: string; / Size: 18, Description: ABA Bank Shortname /
AbaAddress: string; / Size: 36, Description: ABA Bank Address /
AbaState: string; / Size: 2, Description: ABA Bank State /
AbaCity: string; / Size: 25, Description: ABA Bank City /
AbaZip: number; / Size: 9, Description: ABA Bank Zip Code /
AbaPhone: number; / Size: 10, Description: ABA Bank Telephone /
AbaAllowach: string; / Size: 1, Description: Allow ACH Transactions to this Bank /
AbaWirefunds: string; / Size: 1, Description: Allow Wires to this Bank /
AbaFiller: string; / Size: 53, Description: Additional space for future growth */
}
The text was updated successfully, but these errors were encountered: