Add support for OpenAPI spec 3.2

未关闭
#3,324 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 9 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
48/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
冷清
技术栈
java, openapi, spring-boot
领域
api, backend

调研方向

Start by reading how springdoc generates api-docs and handles OpenAPI specification versions, then compare its current 3.1 support with the requested 3.2 behavior. Done means springdoc can generate api-docs using version 3.2.x and represent the XML element with attributes and text content as described.

由索引模型根据 Issue 内容生成。

描述

enhancement upstream

Is your feature request related to a problem? Please describe.

My problem is that I want to describe an XML schema and generate examples that have an element with attributes and a text-type child element:

<request>
  <signature version="2.0">123abc</signature>
</request>

The result when translating the DAO with JAXB

@Schema
@XmlRootElement(name = "request")
public class Request {
  @XmlElement(name = "signature")
  public Signature signature;

  public class Signature {
    @Schema(example = "2.0")
    @XmlElement(name = "version")
    public String version;

    @Schema(example = "123abc")
    @XmlValue
    public String value;
}

but rendering it with springdoc 2.8.17 and OpenAPI 3.1 gives me the api-docs:

<request>
  <signature version="2.0">
    <value>123abc</value>
  </signature>
</request>

Describe the solution you'd like
The lack of support for this stems from OpenAPI not supporting this as of spec 3.1. There was an issue filed for OpenAPI-Specification https://github.com/OAI/OpenAPI-Specification/issues/630. It was implemented in https://github.com/OAI/OpenAPI-Specification/pull/4592 and released in https://github.com/OAI/OpenAPI-Specification/releases/tag/3.2.0.

So I'd like springdoc to add support for api-docs version 3.2.x.

Describe alternatives you've considered
My alternative for now is to hard-code the example into my api-docs and accept the wrong looking schema until newer OpenAPI spec versions.

主要语言
Java
星标
3.7k
派生
605
平均合并
9 天 11 小时
30 天内合并 PR
14

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

springdoc/springdoc-openapi 的其他 Issue

查看 springdoc/springdoc-openapi 的全部 Issue

相似的 Issue

更多 Java Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。