Changing non-primitive type mapping for codegen?

852 views
Skip to first unread message

Adam Smoulder

unread,
Mar 17, 2016, 3:08:34 PM3/17/16
to Swagger
Does anyone know if there's a way to change the way a type is mapped in codegen, or where in the source I'd have to edit to do so? For example, whenever java codegen is done, what I designate at a DateTime is converted to a type of Date, but I want it to be LocalDate / JodaDate / something else.

Thanks in advance.

Kenji Tayama

unread,
Mar 17, 2016, 10:01:44 PM3/17/16
to Swagger
Are you generating a client library?
I think you can change mappings for dateTime too, although it may not be marked as primitive.
Like this:

--type-mappings dateTime=JodaDate


One thing extremely useful that is not mentioned in the README, is the debugOperations and debugModels option.


2016年3月18日金曜日 4時08分34秒 UTC+9 Adam Smoulder:

Kenji Tayama

unread,
Mar 18, 2016, 1:39:05 AM3/18/16
to Swagger
Maybe 'dateTime' needs to be 'DateTime' (--type-mappings DateTime=JodaDate).
Which was the case for SwiftCodegen.java.


2016年3月18日金曜日 11時01分44秒 UTC+9 Kenji Tayama:

wing328

unread,
Mar 21, 2016, 9:40:16 AM3/21/16
to Swagger
Java API clients supports the following date library:

dateLibrary

    Option. Date library to use

        joda - Joda

        java8 - Java 8 native


Please run `java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar config-help -l java` for more information on various option to customize the Java API client.



Kenji Tayama於 2016年3月18日星期五 UTC+8下午1時39分05秒寫道:
Reply all
Reply to author
Forward
0 new messages