Skip to content

Add support to configure packages-to-scan as list using YAML Syntax #376

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

Closed
pieterdegraeuwe opened this issue Jan 25, 2020 · 4 comments
Closed
Labels
enhancement New feature or request

Comments

@pieterdegraeuwe
Copy link

I am not able to use packages-to-scan nor paths-to-match. using one package or one path does work.
However, from the moment I want a list of more than one element it resolves in just one list with one element, of null:

`springdoc :
packages-to-scan :

  • val1
  • val2
    (the dots are dashes, escaping them in markdown does not seem to work)
    `

springdoc : packages-to-scan : some.package
Gives a list, with one element. (so this seems to work als long as you need only one package/path)

springdoc : packages-to-scan : some.package, some.secondpackage
does resolve in a list with one element ; "some.package, some.secondpackage', which is of course not the result we want.

Looking to the code, I think that it just cannot work. It is used as a simple @value(SPRINGDOC_PACKAGES_TO_SCAN) inside the AbstractOpenApiResource, while (I think) those lists only work in ConfigurationProperties.

Easy to reproduce: add
@Value(SPRINGDOC_PACKAGES_TO_SCAN) private List<String> packagesToScan;
in the test AbstractSpringDocTest. and add some packages to the application-test.yml

Any hints how to get around this? (or am I missing something?)
Thanks

@bnasslahsen
Copy link
Collaborator

bnasslahsen commented Jan 26, 2020

@pablomusumeci,

The property SPRINGDOC_PACKAGES_TO_SCAN is already defined in SpringDocConfigProperties.
You have already sample tests with list of values;

springdoc:
  packages-to-scan: test.org.springdoc.api.app63.toto, test.org.springdoc.api.titi

Maybe you are not testing with the latest stable version. v1.2.28
If you are still facing this problems, please add the sample code or your git repository link to reproduce and this issue will be reopened.

@pieterdegraeuwe
Copy link
Author

pieterdegraeuwe commented Jan 26, 2020

@bnasslahsen
I've created a repo which reproduces the problem.
Agreed, using comma separated paths, It seems to work. However, using the standard yml list notation, the list becomes null;

https://github.com/pieterdegraeuwe/springdoc-bugtest/blob/master/src/main/resources/application.yml

@bnasslahsen bnasslahsen reopened this Jan 26, 2020
@bnasslahsen bnasslahsen changed the title Not able to configure packages-to-scan in yml Add support to configure packages-to-scan as list using YAML Syntax Jan 26, 2020
@bnasslahsen
Copy link
Collaborator

I confirm the support to configure package-to-scan as list using YAML syntax will be added for the next release v1.2.29.

@pieterdegraeuwe
Copy link
Author

looking forward tot test that version.
Note that the comma separated list did only seem to work on springboot2, not on springboot1.5

Thx.

@bnasslahsen bnasslahsen added the enhancement New feature or request label Jan 10, 2022
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

No branches or pull requests

2 participants