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

Spec for @ParameterObject disappears if building native-images #2312

Closed
mykhailokulakov opened this issue Jul 17, 2023 · 0 comments
Closed
Labels
bug Something isn't working

Comments

@mykhailokulakov
Copy link

mykhailokulakov commented Jul 17, 2023

Describe the bug

Hey
I'm using spring-boot 3.1.1 and springdoc-openapi 2.1.0
When annotating the Pageable interface with @ParameterObject, everything works smoothly for a traditional build, with parameters being generated as expected:

"parameters": [
  {
	"name": "productId",
	...
  },
  {
	"name": "userId",
	...
  },
  {
	"name": "page",
	"in": "query",
	"description": "Zero-based page index (0..N)",
	"required": false,
	"schema": {
	  "minimum": 0,
	  "type": "integer",
	  "default": 0
	}
  },
  {
	"name": "size",
	"in": "query",
	"description": "The size of the page to be returned",
	"required": false,
	"schema": {
	  "minimum": 1,
	  "type": "integer",
	  "default": 20
	}
  },
  {
	"name": "sort",
	"in": "query",
	"description": "Sorting criteria in the format: property,(asc|desc). Default sort order is ascending. Multiple sort criteria are supported.",
	"required": false,
	"schema": {
	  "type": "array",
	  "items": {
		"type": "string"
	  }
	}
  }
],

But if running a native image, this part is missing from the generated spec:

"parameters": [
  {
    "name": "productId",
    ...
  },
  {
    "name": "userId",
    ...
  }
],

To Reproduce

spring-boot-starter-parent 3.1.1
springdoc-openapi-starter-webmvc-ui 2.1.0

@RestController
@RequestMapping("/tickets")
@RequiredArgsConstructor
@FieldDefaults(level = AccessLevel.PRIVATE, makeFinal = true)
@Tag(name = "Tickets API")
public class TicketController  {
    TicketService service;

    @GetMapping
    @Operation(summary = "Search tickets")
    @PageableAsQueryParam
    ResponsePage<Ticket> search(
            @RequestParam(value = "productId", required = false) UUID productId,
            @RequestParam(value = "userId", required = false) UUID userId,
            @Parameter(hidden = true) Pageable page) {
        return service.search(productId, userId, page);
    }
}

mvn -Pnative spring-boot:build-image

Expected behavior

It should work on a native-image

Screenshots

regular build:

Screenshot 2023-07-18 002054

native:
Screenshot 2023-07-18 004252

Additional context
I've tried to add ParameterObject in reflection and serialization configs but no luck

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants