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

Specify a different root path for files #176

Closed
gwydionmv opened this issue Nov 17, 2022 · 5 comments · Fixed by #179
Closed

Specify a different root path for files #176

gwydionmv opened this issue Nov 17, 2022 · 5 comments · Fixed by #179
Assignees
Labels
enhancement New feature or request

Comments

@gwydionmv
Copy link
Contributor

I'd like to add a new functionality to the generators to allow changing the root path from "src/main/openapi" to a custom one, and also being able to filter which files inside that directory must be used. I've been doing some tests and it could be done with just 2 new optional properties and a couple of new lines in OpenApiGeneratorCodeGenBase.

I found that OpenApiGeneratorStreamCodeGen could potentially achieve something similar but it needs to create a new library to define the new provider.

What do you think? Thanks!

@hbelmiro
Copy link
Contributor

Go ahead @gwydionmv. I can help with the review.
I think you can do it in OpenApiGeneratorCodeGenBase.

Regarding a filter, we already have something similar implemented but not yet released.
https://github.com/quarkiverse/quarkus-openapi-generator#ignoring-openapi-specification-files
If you need this now we can release a new version. Just let me know.

@gwydionmv
Copy link
Contributor Author

Nice @hbelmiro , thanks a lot!

About that filter using an ignore property, I considered using it but for our use case it's going to be much better having a "positive filter" than a negative one. I also think that it helps towards maintainability specifying which files to use than which not to use.

And if not, better having both functionalities and let everyone use the one they prefer 😃

@hbelmiro
Copy link
Contributor

@gwydionmv sounds reasonable.
@ricardozanini any consideration?

@ricardozanini
Copy link
Member

@gwydionmv, why change the default directory from src/main/openapi to any other? I think it's fine for filtering, but let's try merging it with the ignore filtering feature. What I mean is that both should be ubiquitous in UX. For example:

quarkus.open-api.generator.codegen.include=<expression>
quarkus.open-api.generator.codegen.exclude=<expression>

Also, let's design so that OpenApiGeneratorCodeGenBase would be associated with this feature and not implemented directly in that class.

Lastly, you can implement your own filtering/source via OpenAPISpecInputProvider implementation.

I'd rather not change the default path via property.

@gwydionmv
Copy link
Contributor Author

@ricardozanini I'm working on a project in which we have several products (microservices) that comunicate with each other. We want to use git submodules to share the openapi formats across all of them, and we just need some of the client classes in each of the microservices. That's the reason for both features: changing the base directory to be able to load the files from the submodule, and selecting which files are to be analysed depending on the product (as I said before, it's more maintainable to select the ones we want than the ones we don't).

I already aligned the properties to be include/exclude as you said before, I'll open the PR and we can continue the discussion over there. Thanks!

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

Successfully merging a pull request may close this issue.

3 participants