openapi-processor / openapi-processor/openapi-processor-spring

interpretation of openapi readOnly flag in model

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

还没有人认领这个 Issue。

主要语言
Kotlin
星标
56
派生
11
平均合并
2 天 4 小时
30 天内合并 PR
8

描述

Given a definition like:

``yaml

Data:
  type: object
  properties:        
    status:
      type: string)
      readOnly: true

get generated java:


```java

public record Data {
    @JsonProperty(value = "status", access = JsonProperty.Access.READ_ONLY)
    String status
) {}

This is correct if the generated code is for the provider of the interface (i.e. server-side). But if the code is to be the client of the interface, the field should instead be annotated with JsonProperty.Access.WRITE_ONLY.

So, as a feature request, it would be useful if there was a code generation option that declared the intended usage of the generated code.

See: https://fasterxml.github.io/jackson-annotations/javadoc/2.6/com/fasterxml/jackson/annotation/JsonProperty.Access.html

贡献指南

打开贡献指南

从这里开始

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

调研方向

Issue 中未标识源文件、测试或入口点。首先跟踪 generator 如何将 OpenAPI 的 readOnly 属性映射到 Jackson 访问注解,然后确定应在哪里配置 provider-versus-client 生成选项,并定义覆盖两种模式的测试。

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

评估

技术栈
java, openapi, spring-boot
领域
backend-api-design, tooling
Issue 类型
功能
难度
5/5
预计耗时
一周以上
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

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