Only regen in sbt OpenAPI codegen when input YAMLs change#5102
Merged
adamw merged 3 commits intosoftwaremill:masterfrom Mar 10, 2026
Merged
Only regen in sbt OpenAPI codegen when input YAMLs change#5102adamw merged 3 commits intosoftwaremill:masterfrom
adamw merged 3 commits intosoftwaremill:masterfrom
Conversation
hughsimpson
approved these changes
Mar 6, 2026
Contributor
hughsimpson
left a comment
There was a problem hiding this comment.
Thanks @aelred this has annoyed me for ages
Contributor
|
Actually I think there are issues with this. If I change the config and rerun, then nothing's regenerated... 🤔 Edit: behaving as desired now, tnx |
hughsimpson
suggested changes
Mar 9, 2026
openapi-codegen/sbt-plugin/src/main/scala/sttp/tapir/sbt/OpenapiCodegenPlugin.scala
Outdated
Show resolved
Hide resolved
Contributor
|
@adamw a big motivation for wanting this is if you have sourcecode generators to subsequently munge the output of the plugin -- ideally we should make it easier to skip those applications. I think this works as desired since locally it helps me skip a bunch of redundant reprocessing; and at least with my suggested changes, I can't think of any other things other than openapi, config, and plugin version that you'd want to react to. |
Co-authored-by: hughsimpson <hughrsimpson@gmail.com>
hughsimpson
approved these changes
Mar 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The current behaviour is:
This saves some work (downstream recompilation etc.) but still means we always run codegen every time.
For larger YAMLs this can take a while, and impacts every build even with no code changes. For me this can add 20-30 seconds to
Changing this behaviour to use
FileFunction.cachedand/ fileInputsto check the input YAML files instead:Manual test
Verified on my project by compiling the API model twice:
Without new plugin: