Skip to content

Commit 2c5b9ec

Browse files
committed
Fix for uncompilable java client if no model definitions i specified (#7836)
After fixes for #6636 the gson based clients would not compile if the swagger json did not have any model definitions. This can be the case if the API only uses simple datastructures for input and output. (int, String, List, Map etc.)
1 parent f9ae84d commit 2c5b9ec

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

modules/swagger-codegen/src/main/resources/Java/JSON.mustache

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ import org.threeten.bp.OffsetDateTime;
2525
import org.threeten.bp.format.DateTimeFormatter;
2626
{{/threetenbp}}
2727

28+
{{#parent.length}}
2829
import {{modelPackage}}.*;
30+
{{/parent.length}}
2931
import okio.ByteString;
3032

3133
import java.io.IOException;

modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/JSON.mustache

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ import org.threeten.bp.OffsetDateTime;
2525
import org.threeten.bp.format.DateTimeFormatter;
2626
{{/threetenbp}}
2727

28+
{{#parent.length}}
2829
import {{modelPackage}}.*;
30+
{{/parent.length}}
2931

3032
import java.io.IOException;
3133
import java.io.StringReader;

0 commit comments

Comments
 (0)