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

interpretation of openapi readOnly flag in model

Open
#334 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Kotlin
Stars
56
Forks
11
Avg merge
2d 4h
Merged PRs (30d)
8

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source files, tests, or entry points are identified in the issue. Start by tracing how the generator maps OpenAPI readOnly properties to Jackson access annotations, then determine where a provider-versus-client generation option should be configured and define tests covering both modes.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, openapi, spring-boot
Domain
backend-api-design, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.