Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix an exception generate split class code with json: #236

Merged
merged 1 commit into from
Aug 31, 2019

Conversation

wuseal
Copy link
Owner

@wuseal wuseal commented Aug 31, 2019

Fix split class generate code error with next json

{
"text": "MXCHIP won a prize",
"id":1234,
"detail": {
     "comp":"MXCHIP.Inc",
     "from":"Shanghai",
     "focus":"Internet of Things",
     "module":[{"k":"EMW3165"},{"k":"EMW3166"},{"k":"EMW3167"},{"k":"EMW3168"}]
   }
}

before it will generate code like this:

data class Test(
            var detail: Detail = Detail(),
            var id: Int = 0, // 1234
            var text: String = "" // MXCHIP won a prize
        )
        
        data class Detail(
            var comp: String = "", // MXCHIP.Inc
            var focus: String = "", // Internet of Things
            var from: String = "", // Shanghai
            var module: Module = listOf()
        )
        
        data class Module(
            var k: String = "" // EMW3168
        )

var module: Module = listOf()
should be
var module: List<Module> = listOf()

```json
{
"text": "MXCHIP won a prize",
"id":1234,
"detail": {
     "comp":"MXCHIP.Inc",
     "from":"Shanghai",
     "focus":"Internet of Things",
     "module":[{"k":"EMW3165"},{"k":"EMW3166"},{"k":"EMW3167"},{"k":"EMW3168"}]
   }
}
```
@wuseal wuseal self-assigned this Aug 31, 2019
@wuseal wuseal added this to the 3.5.0 milestone Aug 31, 2019
@wuseal wuseal added the bug fix For PR means this PR is used to fix bugs label Aug 31, 2019
@wuseal wuseal requested a review from xurui1995 August 31, 2019 13:28
@xurui1995
Copy link
Collaborator

LGTM

@xurui1995 xurui1995 merged commit 4308f10 into 3.5.0 Aug 31, 2019
@wuseal wuseal added the L3 Difficulty level 3 (Maximum is 9) label Sep 1, 2019
@wuseal wuseal deleted the 3.5.0-bugfix/json-generate-unexcpect branch September 6, 2019 03:29
wuseal pushed a commit that referenced this pull request Sep 20, 2021
fix an exception generate split class code with json:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug fix For PR means this PR is used to fix bugs L3 Difficulty level 3 (Maximum is 9)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants