Closed
Description
Description
When I generate client code for Flutter client, double type on BE has default value is 0 and when to Dart code 0 cannot assign to double. Then I need to manually add 0.toDouble() to generated model class. Can you help me to handle this case?
Swagger-codegen version
Version : 2.4.12
Swagger declaration file content or url
{
"swagger": "2.0",
"info": {
"title": "Feedback API",
"version": "v1"
},
"paths": {
"/feedback": {
"post": {
"tags": [
"Feedback"
],
"summary": "Feedback issue",
"operationId": "feedback.post",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"parameters": [
{
"in": "header",
"name": "Authorization",
"description": "Bearer [JWT]",
"type": "String"
},
{
"in": "header",
"name": "Accept-Language",
"description": "en-US, vi-VN",
"type": "String"
},
{
"in": "body",
"name": "body",
"schema": {
"$ref": "#/definitions/IssueFeedback"
}
}
],
"responses": {
"200": {
"description": "Feedback successfully",
"schema": {
"$ref": "#/definitions/Result"
}
},
"500": {
"description": "Feedback failed",
"schema": {
"$ref": "#/definitions/Error"
}
}
}
}
},
"/rate/{productId}": {
"get": {
"tags": [
"Rate"
],
"summary": "Get rate of product",
"operationId": "rate.get",
"produces": [
"application/json"
],
"parameters": [
{
"in": "path",
"name": "productId",
"description": "Product Id",
"required": true,
"type": "string",
"format": "uuid"
},
{
"in": "header",
"name": "Accept-Language",
"description": "en-US, vi-VN",
"type": "String"
}
],
"responses": {
"200": {
"description": "Get rate successfully",
"schema": {
"$ref": "#/definitions/ProductRateDetail"
}
},
"500": {
"description": "Get rate failed",
"schema": {
"$ref": "#/definitions/Error"
}
}
}
}
},
"/rate": {
"post": {
"tags": [
"Rate"
],
"summary": "Rate product",
"operationId": "rate.post",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"parameters": [
{
"in": "header",
"name": "Authorization",
"description": "Bearer [JWT]",
"type": "String"
},
{
"in": "header",
"name": "Accept-Language",
"description": "en-US, vi-VN",
"type": "String"
},
{
"in": "body",
"name": "body",
"schema": {
"$ref": "#/definitions/Rate"
}
}
],
"responses": {
"200": {
"description": "Rate successfully",
"schema": {
"$ref": "#/definitions/Result"
}
},
"500": {
"description": "Rate failed",
"schema": {
"$ref": "#/definitions/Error"
}
}
}
}
}
},
"definitions": {
"IssueFeedback": {
"type": "object",
"properties": {
"content": {
"type": "string"
},
"attachedUrl": {
"type": "string"
}
}
},
"Result": {
"type": "object",
"properties": {
"status": {
"type": "string"
},
"messages": {
"type": "array",
"items": {
"type": "string"
}
},
"content": {
"type": "string"
}
}
},
"Error": {
"type": "object",
"properties": {
"messages": {
"type": "array",
"items": {
"type": "string"
}
},
"status": {
"type": "string"
}
}
},
"Rate": {
"type": "object",
"properties": {
"productId": {
"format": "uuid",
"type": "string"
},
"score": {
"format": "int32",
"type": "integer"
},
"fullName": {
"type": "string"
},
"comment": {
"type": "string"
},
"ratedTime": {
"format": "date-time",
"type": "string"
}
}
},
"ProductRateDetail": {
"type": "object",
"properties": {
"productId": {
"format": "uuid",
"type": "string"
},
"average": {
"format": "double",
"type": "number"
},
"total": {
"format": "int32",
"type": "integer"
},
"rates": {
"type": "array",
"items": {
"$ref": "#/definitions/Rate"
}
}
}
}
},
"tags": [
{
"name": "Feedback",
"description": "Feedback"
},
{
"name": "Rate",
"description": "Get rating product, rate product"
}
]
}
Command line used for generation
java -jar .\swagger-codegen-cli.jar generate -l dart -i swagger.json -o ..\client_sdk -DbrowserClient=false
Metadata
Metadata
Assignees
Labels
No labels