Description
I have date-time field in my spec.
definitions:
MDCTrace:
title: MDC Trace definition
type: object
properties:
expirationTime:
type: string
format: date-time
readOnly: true
Although "expitationTime" has a date format in generated java code, it displays as a number on UI page:
Response Body:
[
{
"expirationTime": 1474344922000
}
]
Swagger-codegen version
I use docker image for generation
https://github.com/mydock/swagger-codegen-prebuilt
Swagger declaration file content or url
swagger: '2.0'
# This is your document metadata
info:
version: "0.1.0"
title: 'TITLE'
description: |
Description.
contact:
name: API Support
url: http://uri.ru/
email: mail@mail.ru
produces:
- application/json
definitions:
MDCTrace:
title: MDC Trace definition
properties:
expirationTime:
type: string
readOnly: true
paths:
/mdc/traces:
get:
description: |
Get MDC Traces definitions.
tags:
- traces
operationId: getMDCTraces
responses:
200:
description: |
MDC Traces definitions.
schema:
title: ArrayOfMDCTaces
type: array
items:
$ref: '#/definitions/MDCTrace'
default:
description: |
Generic Error.
Command line used for generation
docker run --rm -t -v $(pwd):/code mydock/swagger-codegen-prebuilt generate -i /code/swagger.yaml -l spring-mvc -o /code/app
Steps to reproduce
- Generate code with spec
- Create in "/mdc/traces" method's handler (getMDCTraces()) instance of MDCTrace class.
- Return it as a list of MDCTraces
return new ResponseEntity<List<MDCTrace>>(list, HttpStatus.OK);
- Make a query and look at expirationTime field
Related issues
not found
Suggest a Fix
I suppose, the problem in displaying on the web page, because before the line
return new ResponseEntity<List<MDCTrace>>(list, HttpStatus.OK);
expirationTime displayed as normal date in Java code.
Description
I have date-time field in my spec.
Although "expitationTime" has a date format in generated java code, it displays as a number on UI page:
Swagger-codegen version
I use docker image for generation
https://github.com/mydock/swagger-codegen-prebuilt
Swagger declaration file content or url
Command line used for generation
docker run --rm -t -v $(pwd):/code mydock/swagger-codegen-prebuilt generate -i /code/swagger.yaml -l spring-mvc -o /code/app
Steps to reproduce
return new ResponseEntity<List<MDCTrace>>(list, HttpStatus.OK);Related issues
not found
Suggest a Fix
I suppose, the problem in displaying on the web page, because before the line
return new ResponseEntity<List<MDCTrace>>(list, HttpStatus.OK);expirationTime displayed as normal date in Java code.