FasterXML / FasterXML/jackson-module-kotlin

Classes with properties from both constructor and fields are not alphabetically sorted with @JsonPropertyOrder

Aperta
#271 10 commenti 0 reazioni 0 assegnatari Vedi su GitHub
has-test-case
Lingua principale
Kotlin
Stelle
1.2k
Fork
187
Merge medio
9h 48m
PR unite (30g)
16

Descrizione

With the following data class:

```kotlin
import com.fasterxml.jackson.annotation.JsonPropertyOrder

@JsonPropertyOrder(alphabetic=true)
data class Object(val a: String, val c: Int) {
val b = false
}
```

and the following main function:

```kotlin
fun main(args: Array) {
println(ObjectMapper().registerModule(KotlinModule()).writeValueAsString(Object("a", 1)))
}
```

I get the following output:

```
{"a":"a","c":1,"b":false}
```

i.e. constructor parameters first, then fields. I'd expect all properties to be alphabetically sorted.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.