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.
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
Revert "remove everything" #1
Revert "remove everything" #1
Changes from 1 commit
4e28198
9ab35e9
52da34c
d956824
c879f91
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the version should be extracted to a constant. Also, I'd use circe as it's the more popular choice
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We cannot use circe, as this plugin contains openapi-generator in 4.3.1 version which doesn't contain improved sttp generator. I've created an issue to release newer version: OpenAPITools/sbt-openapi-generator#15
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
even better, the version of the openapi-generator to use could be configured as a setting of the plugin (not hard-coded)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also thought about such approach but that seems to counter the openapi convention. Other plugins like gradle and maven are released each time a new version of generator came out. Probably there is a good reason for that. There is already an issue in sbt-openapi-plugin project to setup an automatic release process based on openapi-generator's releases. (OpenAPITools/sbt-openapi-generator#2)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should generate those into src-managed. See: https://www.scala-sbt.org/1.x/docs/Howto-Generating-Files.html
Maybe we can also leverage the
sourceGenerators
task?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That looks awesome, unfortunately we can't use
sourceGenerators
because this requires all files to be compile-able and despite explicitly saying to generator that we want onlysrc/main
files it also generates.openapi-generator-ignore
and.openapi-generator/VERSION
files ...I also agree that we should use
sourceManaged
, but while it works I am not sure if it is safe since the generator still doesn't allow us change the destination of the source files - we can only change the baseDir directory.So it looks like this:
So after all it seems like this ignoreFile isn't what we were looking for.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder what implications would be of doing it in the openapi-way. We could generate a self-containing sbt-project into petstore-api directory and since it contains build.sbt file it will be recognized by the root project. am I right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, but it would also contain its own settings, which would overwrite user's settings. We don't want to do that - the plugin should only do its job: generate a client, and minimally interfere with other parts of the project
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, so that's a bug in the openapi sbt-plugin or the generator. We'll have to live with that so far :). So maybe we can leave this as-is, but add a comment on why
sourceGenerators
are not used, and link to issues (if they exist) which report the problem?Well it is, but needs fixing, no? ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree, currently there is no issue apart from OpenAPITools/openapi-generator#6685 but I think that it will evolve into new one, probably in sbt-openapi-plugin.
I think that it is something which by coincidence was partially useful for us, but I cannot image it being changed in such a way that will allow us to put sources into srcManaged directly. I wasn't just build for that purpose.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just filed a PR against OpenAPITools that would allow use of sbt source generators by disabling metadata file generation in a way compatible with the sbt plugin.
If that's interesting to you still it could use some support!
OpenAPITools/openapi-generator#7862