Property type "null" is missing if Kotlin property name does not equal OpenAPI property name
メンテナーはふだん 9 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 66/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- java, kotlin, spring-boot
- 領域
- api
調査の方向性
Start by reproducing the issue with the supplied Kotlin Request model and inspect the generated OpenAPI schema for its three properties. Trace how schema generation handles Kotlin nullability and the @JsonProperty name. Done means the type: "null" output is consistent for properties whether or not their JSON names match their Kotlin names.
索引モデルが issue の本文から書いたものです。
説明
Describe the bug
- A nullable Kotlin property gets
type: "null"when the@JsonPropertyname equals the Kotlin property name, but not if the names are different.
To Reproduce
- springdoc-openapi-starter-webmvc-ui 3.2.0
- Spring Boot 4.1.2
- Kotlin 2.3.21 with JDK 21
- com.fasterxml.jackson.core:jackson-core:2.21.7
- tools.jackson.core:jackson-core:3.1.7
import com.fasterxml.jackson.annotation.JsonProperty
import io.swagger.v3.oas.annotations.media.Schema
import org.springframework.boot.autoconfigure.SpringBootApplication
import org.springframework.boot.runApplication
import org.springframework.web.bind.annotation.PostMapping
import org.springframework.web.bind.annotation.RequestBody
import org.springframework.web.bind.annotation.RestController
@SpringBootApplication
class SpringdocBugApplication
fun main(args: Array<String>) {
runApplication<SpringdocBugApplication>(*args)
}
data class Request(
@get:Schema(description = "JSON name == property name -> schema contains type \"null\"")
val myproperty1: String? = null,
@get:JsonProperty("myproperty2_suffix")
@get:Schema(description = "JSON name != property name -> no \"null\" type in schema")
val myproperty2: String? = null,
@get:Schema(
nullable = false,
description = "JSON name == property name and \"nullable = false\" -> schema contains type \"null\""
)
val myproperty3: String? = null,
)
@RestController
class Controller {
@PostMapping("/test")
fun test(@RequestBody r: Request) = Unit
}
Resulting OpenAPI spec:
openapi: 3.1.0
# ...
components:
schemas:
Request:
type: object
properties:
myproperty1:
type:
- string
- "null"
description: JSON name == property name -> schema contains type "null"
myproperty3:
type:
- string
- "null"
description: JSON name == property name and "nullable = false" -> schema
contains type "null"
myproperty2_suffix:
type: string
description: JSON name != property name -> no "null" type in schema
Expected behavior
- Type "null" should be assigned consistently for all properties, not depending on Kotlin property name
- 主要言語
- Java
- スター
- 3.7k
- フォーク
- 605
- 平均マージ
- 9日 11時間
- マージ済み PR(30日)
- 14
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
springdoc/springdoc-openapi のほかの issue
-
enhancement upstream
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
springdoc/springdoc-openapi#3324 · コメント 2 件 ·
メンテナーはふだん 9 日以内に返信
-
enhancement upstream
難易度 3/5 1〜2日 初心者へのやさしさ 55/100
springdoc/springdoc-openapi#3309 · コメント 4 件 · リアクション 1 件 ·
メンテナーはふだん 9 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
springdoc/springdoc-openapi#3404 · コメント 1 件 ·
メンテナーはふだん 9 日以内に返信
springdoc/springdoc-openapi の issue をすべて見る
似ている issue
-
Type: Bug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
MCP add-on: JSON responses with non-ASCII characters are truncated (wrong Content-Length)対応中かも @dhanushbs10 が今日担当しました。 オープンadd-on bug in:mcp
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
vaadin-map
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
vaadin/flow-components#10586 ·
メンテナーはふだん 1 日以内に返信
-
WeReadInstaller writes the launcher database on the main thread at handover (Activity pause timeout)オープンbug good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 63/100
wpilibsuite/SystemcoreTesting#446 ·
メンテナーはふだん 1 日以内に返信