Skip to content

HTTP GET with query params as @ParameterObject with object type @Schema field - doesn't appear as plain String #1340

@olliekrk

Description

@olliekrk

Hello Team,

I am backend developer using springdoc-openapi-ui with Spring Boot MVC.

Describe the bug

I am using wrapper classes (having single field that is deserialized by Jackson as String) such as OrganizationId in an example below.

@Value
@Schema(implementation = String.class)
public class OrganizationId {
    String id;
}

This field when a part of HTTP POST body is displayed as String in generated OpenAPI yaml - which is what my intent is.
The problem is when I try to do the same for HTTP GET using object as wrapper for query parameters together with @ParameterObject annotation, as in the below example:

@Value
@Builder
@AllArgsConstructor
@ParameterObject
public class EmployeeFilter {
    @Parameter(name = "organizationId", description = "Id of an organization")
    OrganizationId organizationId;
    @Parameter(description = "Id of an employee")
    String employeeId;
}

// and in the controller:

@GetMapping(value = {"/employee"})
@Operation(summary = "Get employee")
public ResponseEntity<Object> getEmployee(EmployeeFilter employeeFilter) {
    return null;
}

@Value, @Builder, @AllArgsConstructor comes from lombok.

In a generated YAML there is:

parameters:
        - name: employeeId
          in: query
          schema:
            type: string
        - name: organizationId.id
          in: query
          schema:
            type: string

Which is a problem because the my intention is to display it as a String (because it is correctly instantiated from plain String in a query: ?organizationId=ABC123 not including this .id part).
I would expect it to be organizationId

To Reproduce
Steps to reproduce the behavior:

  • Use provided code examples to reproduce

springdoc-openapi-ui 1.5.2

Expected behavior

  • I would like parameter name to be visible as organizationId without .id suffix

Metadata

Metadata

Assignees

No one assigned

    Labels

    invalidThis doesn't seem right

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions