swagger-api / swagger-api/swagger-codegen
[SWIFT 4] BigDecimal support in Swift4Codegen not available.
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
Swift4Codegen.java does not have type mapping for bigdecimal. Even if we add the below line
typeMapping.put("bigdecimal", "Double");
in Swift4Codegen.java and compile the jar and run it. it gives the below error
[main] WARN io.swagger.util.PropertyDeserializer - no property from bigdecimal, null, {ENUM=null, TITLE=null, DESCRIPTION=null, DEFAULT=null, PATTERN=null, DESCRIMINATOR=null, MIN_ITEMS=null, MAX_ITEMS=null, MIN_PROPERTIES=null, MAX_PROPERTIES=null, MIN_LENGTH=null, MAX_LENGTH=null, MINIMUM=null, MAXIMUM=null, EXCLUSIVE_MINIMUM=null, EXCLUSIVE_MAXIMUM=null, UNIQUE_ITEMS=null, EXAMPLE=null, TYPE=bigdecimal, FORMAT=null, READ_ONLY=null, VENDOR_EXTENSIONS={}, MULTIPLE_OF=null}
Swagger-codegen version
master code
Swagger declaration file content or url
swagger: "2.0"
info:
description: "Testing the swagger YAML to swift 4"
version: "1.0.0"
title: "testing swift"
contact:
email: "vpmsureshkumar@gmail.com"
license:
name: "sample code"
host: "localhost:8080"
basePath: "/v2"
schemes:
- "http"
paths:
/user:
put:
summary: "Updated user"
description: "This can only be done by the logged in user."
operationId: "updateUser"
produces:
- "application/json"
parameters:
- in: "body"
name: "user"
description: "Updated user object"
required: true
schema:
$ref: "#/definitions/User"
responses:
400:
description: "Invalid user supplied"
404:
description: "User not found"
definitions:
User:
type: "object"
properties:
desk:
type: "bigdecimal"
firstName:
type: "string"
Command line used for generation
swagger-codegen generate -i swagger_1.yaml -l swift4
Steps to reproduce
always
Related issues/PRs
Suggest a fix/enhancement
if I change my yaml and convert the
definitions:
User:
type: "object"
properties:
desk:
type: "number"
firstName:
type: "string"
then it works fine.
please tell me if 'number' should be used for big decimal in yaml? so that it gets converted to Double in swift?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with Swift4Codegen.java and the supplied Swagger YAML, then run the shown swagger-codegen generate -i swagger_1.yaml -l swift4 command to trace how bigdecimal is handled before Swift type mapping. Confirm whether the supported Swagger type should be number or whether bigdecimal needs explicit support, and verify that generation completes with the expected Swift representation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, swift
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100