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 filters run twice when storing #37901

Closed
phillip-kruger opened this issue Dec 22, 2023 · 7 comments · Fixed by #38070
Closed

OpenAPI filters run twice when storing #37901

phillip-kruger opened this issue Dec 22, 2023 · 7 comments · Fixed by #38070

Comments

@phillip-kruger
Copy link
Member

          Yeah, so that is not ideal, I think we can get a better way to do this so that your filter is not run twice. I can look at this. Basically we need to create a document (for inclusion in the runtime), and then use that and only add runtime filters when we store.

I am about to take a break (summer holiday) so I'll only look at this next year. If you are in a hurry, you are welcome to do a PR ?

W.r.t priority, yeah that is something we can add. Having multiple filters is Quarkus specific (the spec only allow one) so from a spec p.o.w a user needs to do everything in one filter. But because we allow many we can look at a way to order them for sure

Originally posted by @phillip-kruger in #36152 (comment)

Copy link

quarkus-bot bot commented Dec 22, 2023

/cc @EricWittmann (openapi), @MikeEdgar (openapi)

@phillip-kruger phillip-kruger self-assigned this Dec 22, 2023
@mcruzdev
Copy link
Contributor

Hi @phillip-kruger, if you want, I can get this issue.

@phillip-kruger
Copy link
Member Author

Go for it! Thanks

@mcruzdev
Copy link
Contributor

mcruzdev commented Jan 2, 2024

Hi @phillip-kruger getting a first look into the code, I saw that the filter is called two times because:

The method responsible for executing filter is prepareOpenApiDocument(staticModel, annotationModel, openAPIBuildItems, index) and is called by:

  1. loadDocument(OpenAPI staticModel, OpenAPI annotationModel, List<AddToOpenAPIDefinitionBuildItem> openAPIBuildItems, IndexView index)
  2. storeDocument(OutputTargetBuildItem out, SmallRyeOpenApiConfig smallRyeOpenApiConfig, IndexView index, OpenAPI loadedModel, boolean includeRuntimeFilters)

I have a question:

The filter with RunStage OpenApiFilter.RunStage.BUILD should appear in http://localhost:8080/q/openapi download or just when generating via build or both?

@phillip-kruger
Copy link
Member Author

Both

@mcruzdev
Copy link
Contributor

Hi @phillip-kruger, HAY? Can you review the pull request #38070?

@phillip-kruger
Copy link
Member Author

Away from PC at the moment, back next week

@quarkus-bot quarkus-bot bot added this to the 3.9 - main milestone Feb 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants