glideapps/quicktype

Kotlin date and datetime types are generated as strings from json schema

已關閉

#2,460 建立於 2024年1月3日

 (0 則留言) (0 個反應) (0 位負責人)TypeScript (968 個分叉)batch import
Kotlinbuggood first issueinput:JSON Schema

倉庫指標

星標
 (10,867 顆星)
PR 合併指標
 (30 天內沒有已合併 PR)

描述

Kotlin generated data classes use string instead of date or datetime Here is the part of the schema: "properties": { "PlannedDateTime" : { "type" : "string", "format" : "date-time", "examples" : [ "2020-02-03T08:00:00.000+01:00" ], "description" : "When the planing process is finished, this timestamp is set and never changed afterwards (frozen value). It is expressed as a local time plus timezone offset, so UTC can be derived by a simple calculation." }, "pokemon": { "type": "array", "description": "All pokémon contained in the pokédex", "items": { "$ref": "#/definitions/Pokemon" }

    }
  },

Generated result is:

data class PokedexSchema ( /** * When the planing process is finished, this timestamp is set and never changed afterwards * (frozen value). It is expressed as a local time plus timezone offset, so UTC can be * derived by a simple calculation. */ val plannedDateTime: String,

/**
 * All pokémon contained in the pokédex
 */
val pokemon: List<Pokemon>

)

貢獻者指南