Skip to content

Fix/#236 Uncompilable code generation caused by invalid variable name#237

Merged
stevehu merged 11 commits intodevelopfrom
fix/#236-API-73
Mar 13, 2019
Merged

Fix/#236 Uncompilable code generation caused by invalid variable name#237
stevehu merged 11 commits intodevelopfrom
fix/#236-API-73

Conversation

@jiachen1120
Copy link
Copy Markdown
Contributor

@jiachen1120 jiachen1120 commented Feb 25, 2019

Related issue: #236

Related RFC: https://github.com/networknt/light-rfcs/blob/master/light-codegen/0005-fix-uncompilable-generation-caused-by-naming.md

Related Jira ticket: API-73

Look forward to your reviews!

- fix invalid variable name, same variable name using java keywords
- fix invalid generic in List and Map
- fix invalid enum name, some enum name is number
- fix invalid variable name, same variable name using java keywords
- fix invalid generic in List and Map
@jiachen1120 jiachen1120 changed the title Fix/#236 api 73 Fix/#236 Uncompilable code generation caused by invalid variable name, enum name and generic of List or Map Feb 26, 2019
@jiachen1120 jiachen1120 changed the title Fix/#236 Uncompilable code generation caused by invalid variable name, enum name and generic of List or Map Fix/#236 Uncompilable code generation caused by invalid variable name Feb 26, 2019
@DSchrupert
Copy link
Copy Markdown
Member

@jiachen1120 could we use the SourceVersion.isName(..) method to simplify this maybe? https://docs.oracle.com/javase/8/docs/api/index.html?javax/lang/model/SourceVersion.html

@DSchrupert
Copy link
Copy Markdown
Member

@jiachen1120 could you resolve the conflicts on this?

private Map<String, String> typeMapping = new HashMap<>();

private static List<String> javaKeyWordList = new ArrayList<>(Arrays.asList("abstract", "continue", "for", "new",
"switch", "assert", "default", "goto", "package", "synchronized", "boolean", "do", "if", "private", "this",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Seems like you have different implementations of detecting java keywords between openapi and swagger now

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@NicholasAzar I forgot to update the swagger one, I will modify the swagger one to sync with openapi

@stevehu stevehu merged commit dd2d4e3 into develop Mar 13, 2019
@stevehu stevehu deleted the fix/#236-API-73 branch March 13, 2019 12:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants