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

OpenAPI UI displays incorrect values for overridden QueryParams using DefaultValue #27058

Closed
mluypaert opened this issue Aug 1, 2022 · 2 comments · Fixed by #27206
Closed
Labels
Milestone

Comments

@mluypaert
Copy link

Describe the bug

When overriding a method with defined @Queryparam's and @DefaultValue's, the swagger UI does not correctly display the newly assigned DefaultValue's from the overridden method.

Say I have an interface with a defined reindex method:

public interface BaseCrudInterface<E extends BaseEntity> {
	
	@GET
	@Path("/reindex")
	@Tag(name = "Reindex Endpoints")
	public void reindex(
		@DefaultValue("2000") @QueryParam("batchSizeToLoadObjects") Integer batchSizeToLoadObjects,
		@DefaultValue("20000") @QueryParam("idFetchSize") Integer idFetchSize,
		@DefaultValue("0") @QueryParam("limitIndexedObjectsTo") Integer limitIndexedObjectsTo,
		@DefaultValue("4") @QueryParam("threadsToLoadObjects") Integer threadsToLoadObjects,
		@DefaultValue("7200") @QueryParam("transactionTimeout") Integer transactionTimeout,
		@DefaultValue("1") @QueryParam("typesToIndexInParallel") Integer typesToIndexInParallel
	);
}

and another interface that extends this base interface and overrides the index method:

public interface AffectedGenomicModelCrudInterface extends BaseCurieCrudInterface<AffectedGenomicModel> {

	@Override
	@GET
	@Path("/reindex")
	@Tag(name = "Reindex Endpoints")
	public void reindex(
		@DefaultValue("60") @QueryParam("batchSizeToLoadObjects") Integer batchSizeToLoadObjects,
		@DefaultValue("0") @QueryParam("idFetchSize") Integer idFetchSize,
		@DefaultValue("0") @QueryParam("limitIndexedObjectsTo") Integer limitIndexedObjectsTo,
		@DefaultValue("1") @QueryParam("threadsToLoadObjects") Integer threadsToLoadObjects,
		@DefaultValue("7200") @QueryParam("transactionTimeout") Integer transactionTimeout,
		@DefaultValue("1") @QueryParam("typesToIndexInParallel") Integer typesToIndexInParallel
	);
}

The endpoint resulting from this AffectedGenomicModelCrudInterface should result in a new default value set for this specific endpoint. However, when looking at the swagger UI for this endpoint, it still shows the default value of the base interface, rather than the specific defaults for the AffectedGenomicModelCrudInterface.
image

When removing these default values and then hitting execute with empty queryparam boxes, the logs learn me that the DefaultValue's specified in the AffectedGenomicModelCrudInterface were applied, and so the overriding did occur as expected, as opposed to the swagger UI display of them.

Expected behavior

The Swagger UI should display the @DefaulValue's as defined in the method from the subclass.

Actual behavior

The Swagger UI displays the @DefaulValue's as defined in the method in the parent class, ignoring any @override's.

How to Reproduce?

Define QueryParams in one class, inherit and override them in another, and watch default values that get displayed in the swagger UI.

Output of uname -a or ver

Linux DESKTOP-OLM4LTH 5.10.102.1-microsoft-standard-WSL2 #1 SMP Wed Mar 2 00:30:59 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

Output of java -version

openjdk version "11.0.15" 2022-04-19

GraalVM version (if different from Java)

No response

Quarkus version or git rev

2.11.1.Final

Build tool (ie. output of mvnw --version or gradlew --version)

Apache Maven 3.8.5

Additional information

No response

@mluypaert mluypaert added the kind/bug Something isn't working label Aug 1, 2022
@quarkus-bot
Copy link

quarkus-bot bot commented Aug 1, 2022

@MikeEdgar
Copy link
Contributor

I'll look at this

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

Successfully merging a pull request may close this issue.

3 participants