Open
Description
Description
The format for a primitive datatype definition is not respected when referenced from other definitions or responses.
Swagger-codegen version
Originally seen in 2.3.0 but also in master
Swagger declaration file content or url
sample api.yml
swagger: '2.0'
info:
title: 'Test'
description:
version: 0.0.1
contact:
name: 'justine'
basePath: /api/
paths:
/test:
get:
operationId: test_operation
produces:
- application/json
parameters: []
responses:
'200':
description: successful operation
schema:
$ref: '#/definitions/Test'
definitions:
Test:
type: object
properties:
Long1:
$ref: "#/definitions/LongProperty"
Long2:
type: integer
format: int64
LongProperty:
type: integer
format: int64
Generated Test model class (partial)
public class Test {
@JsonProperty("Long1")
private Integer long1 = null;
@JsonProperty("Long2")
private Long long2 = null;
public Test long1(Integer long1) {
this.long1 = long1;
return this;
}
...
}
Command line used for generation
swagger-codegen generate -i api.yml -l jaxrs
Steps to reproduce
Copy paste example api.yml file
Run command line
Go to src/gen/java/io/swagger/model/Test.java and the Long1 field will be an Integer but the Long2 field is a Long.
Suggest a fix/enhancement
The format property should be respected for primitive datatype Definitions.