-
Notifications
You must be signed in to change notification settings - Fork 6k
Closed
Labels
Milestone
Description
Considering the following Swagger Specification:
swagger: '2.0'
info:
title: Fake API
description: A simple sample
version: 1.0.0
host: localhost:8080
schemes:
- http
basePath: /api
produces:
- application/json
- application/xml
securityDefinitions:
authentication:
type: basic
description: HTTP Basic Authentication. Works over `HTTP`
paths:
/tenants:
get:
security:
- authentication: []
summary: Tenants
description:
Get all the existing tenants
responses:
'200':
description: An array of tenants
schema:
type: array
items:
$ref: '#/definitions/Tenant'
default:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
definitions:
Tenant:
required: [tenant_id]
type: object
properties:
tenant_id:
type: string
description: 'Unique identifier representing a specific tenant'
tenant_uuid:
type: string
format: uuid
description: 'Unique identifier representing a specific tenant'
display_name:
type: string
description: Display name of tenant.
Error:
type: object
properties:
identifier:
type: string
format: uuid
message:
type: string
fields:
type: string
My model object "Tenant" as an identifier "uuid". I have defined it as a "string" type with the format "uuid". In the Java Client, I was expecting that the field "tenant_uuid" will be an instance of java.util.uuid
However, it is just mapped as a string. The "format" element is ignored by the Java code (not even used for documentation).
/**
* Unique identifier representing a specific tenant
**/
@ApiModelProperty(value = "Unique identifier representing a specific tenant")
@JsonProperty("tenant_uuid")
public String getTenantUuid() {
return tenantUuid;
}
public void setTenantUuid(String tenantUuid) {
this.tenantUuid = tenantUuid;
}After a read of the Swagger Specification, I know the formats such as "uuid" are not defined by the specification. However, is it possible to edit the Swagger Codegen for the Java Client to handle the "uuid" format ?