Skip to content

Description for array schema is being ignored when generating OpenAPI 3.1 #4836

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
jochenberger opened this issue Jan 21, 2025 · 2 comments

Comments

@jochenberger
Copy link

I have the following Java code:

class Street {
        @ArraySchema(schema = @Schema(implementation = House.class, description = "A house in the street"),
                     arraySchema = @Schema(description = "The houses in the street"))
        public List<House> houses;
}

When generating OpenAPI 3.0, I get

Street:
type: object
properties:
  houses:
    type: array
    description: The houses in the street
    items:
      $ref: "#/components/schemas/House"

The item description is missing, but that's another issue (#3900).
However, when I generate OpenAPI 3.1, I get

Street:
type: object
properties:
  houses:
    type: array
    items:
      $ref: "#/components/schemas/House"
      description: A house in the street

Now, the item description is there, but the array description is missing.

@jochenberger jochenberger changed the title Description for array schema is being ignored in 3.1 Description for array schema is being ignored when generating OpenAPI 3.1 Mar 17, 2025
@seskildsen
Copy link

I have the same problem.

See issue where I described the problem:
springdoc/springdoc-openapi#2953

From OpenAPI 3.0:

...
  "components": {
    "schemas": {
          "ClassName": {
            "type": "object",
            "properties": {
              "fieldName1": {
                "type": "string",
                "description": "A text here1."
              },
              "fieldName2": {
                "type": "array",
                "description": "A text here2.",
                "items": {
                  "type": "string"
                }
              }
            }
          }
...

And in OpenAPI 3.1:

...
  "components": {
    "schemas": {
          "ClassName": {
            "type": "object",
            "properties": {
              "fieldName1": {
                "type": "string",
                "description": "A text here1."
              },
              "fieldName2": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            }
          }
...

@jochenberger
Copy link
Author

Doesn't seem to be fixed in 2.2.31.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants