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

[typescript-angular] Add fileNaming configuration property #767

Merged
merged 3 commits into from
Sep 4, 2018

Conversation

softdays
Copy link
Contributor

@softdays softdays commented Aug 8, 2018

Add support for changing output file name strategy.

  • added new option fileNaming
  • current supported values: camelCase, kebab-case
  • default value: camelCase

@softdays softdays changed the title resolve #727 [typescript-angular] add fileNaming configuration property Aug 8, 2018
@@ -449,13 +455,13 @@ public String toApiName(String name) {
}
return initialCaps(name) + serviceSuffix;
}

Copy link
Member

Choose a reason for hiding this comment

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

Please remove these spaces in an empty line.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, done

}
return camelize(removeModelSuffixIfNecessary(name), true) + serviceFileSuffix;
}
return this.convertUsingFileNamingConvention(name) + serviceFileSuffix;
Copy link
Member

Choose a reason for hiding this comment

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

Please use spaces instead of tabs and remove trailing spaces at line 463

Copy link
Member

Choose a reason for hiding this comment

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

Please replace all tabs with 4-space in this file. Let me know if you need any help on that.

@wing328
Copy link
Member

wing328 commented Aug 8, 2018

cc @TiFu (2017/07) @taxpon (2017/07) @sebastianhaas (2017/07) @kenisteward (2017/07) @Vrolijkx (2017/09) @macjohnny (2018/01)

@softdays softdays changed the title [typescript-angular] add fileNaming configuration property [typescript-angular] Add fileNaming configuration property Aug 9, 2018
@softdays
Copy link
Contributor Author

softdays commented Aug 9, 2018

I rebased my PR on the latest master (3.2.1-SNAPSHOT)

@wing328
Copy link
Member

wing328 commented Aug 28, 2018

If there's no further feedback/question on this PR (other than the discussion in the issue tracker), I'll merge it today

@softdays
Copy link
Contributor Author

Unfortunately and from my point of view you cannot merge this PR in this current state. We have to find a way to process 'imports' correctly before...

@wing328
Copy link
Member

wing328 commented Aug 29, 2018

@softdays my understanding is that you've tested with the dash-case option and it works for you. Am I correct? I'll ping you later today to continue the discussion via IM

@softdays softdays force-pushed the resolve_issue727 branch 3 times, most recently from 2235051 to ca8d962 Compare August 29, 2018 15:39
@softdays
Copy link
Contributor Author

@wing328 : ok I think everything is fine now, please have a look.
I finally got my way by adding the original classname in DefaultGenerator to solve the imports issue of the services.
It was found that the model imports were not affected by the naming problem, only service imports were concerned.

@wing328
Copy link
Member

wing328 commented Aug 29, 2018

Thanks @softdays

cc @TiFu (2017/07) @taxpon (2017/07) @sebastianhaas (2017/07) @kenisteward (2017/07) @Vrolijkx (2017/09) @macjohnny (2018/01) for another review

@softdays
Copy link
Contributor Author

last rebase just replaces 'dash-case' to 'kebab-case'

@softdays
Copy link
Contributor Author

softdays commented Aug 31, 2018 via email

@wing328
Copy link
Member

wing328 commented Aug 31, 2018

@softdays I've resolved the merge conflicts via 3c436a8

Would you please review to see if it looks good to you?

@softdays
Copy link
Contributor Author

softdays commented Aug 31, 2018

@wing328 : ok I've checked out, built and run my tests, everything looks good for me

@@ -375,7 +381,7 @@ public void postProcessParameter(CodegenParameter parameter) {
List<Map<String, Object>> imports = (List<Map<String, Object>>) operations.get("imports");
for (Map<String, Object> im : imports) {
im.put("filename", im.get("import"));
im.put("classname", getModelnameFromModelFilename(im.get("filename").toString()));
im.put("classname", im.get("classname")/*getModelnameFromModelFilename(im.get("filename").toString())*/);
Copy link
Member

Choose a reason for hiding this comment

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

Minor suggestion: remove commented code: /*getModelnameFromModelFilename(im.get("filename").toString())*/

Copy link
Contributor Author

@softdays softdays Sep 4, 2018

Choose a reason for hiding this comment

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

Ok no problem but I'm not sure of the branch to make the change ... could you point me to the right direction?

Copy link
Member

Choose a reason for hiding this comment

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

You should do it in resolve_issue727 (the branch of this PR)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok done.

Copy link
Member

Choose a reason for hiding this comment

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

PR merged into master. Thanks for your contribution.

@wing328 wing328 merged commit 7a18a1a into OpenAPITools:master Sep 4, 2018
@wing328
Copy link
Member

wing328 commented Oct 2, 2018

@softdays thanks again for the PR, which is included in the v3.3.0 minor release: https://twitter.com/oas_generator/status/1046941449609068544

A-Joshi pushed a commit to ihsmarkitoss/openapi-generator that referenced this pull request Feb 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants