Skip to content
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

Generic Java types with springdoc 2.8.4 and openapi 3.1 #2901

Open
apet90 opened this issue Feb 12, 2025 · 0 comments
Open

Generic Java types with springdoc 2.8.4 and openapi 3.1 #2901

apet90 opened this issue Feb 12, 2025 · 0 comments

Comments

@apet90
Copy link

apet90 commented Feb 12, 2025

Should generic Java types be represented with dynamic references (https://json-schema.org/blog/posts/dynamicref-and-generics#using-dynamic-references-to-support-generic-types) after recent adoption of openapi 3.1 as the default implementation for springdoc?

My endpoint returns User object:

public class User {
    public String id;
    public CodeDTO<UserRole> userRole;

    public User(String id, CodeDTO<UserRole> userRole) {
        this.id = id;
        this.userRole = userRole;
    }
}

Here is how generated schema looks like for it:

User:
      type: object
      properties:
        id:
          type: string
        userRole:
          $ref: "#/components/schemas/CodeDTOUserRole"

I would expect to have CodeDTO schema to be represented using dynamic reference instead of having CodeDTOUserRole

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

1 participant