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

@ConfigProperty for java.util.Duration with defaultValue flagged as error #1207

Open
fbricon opened this issue Oct 6, 2023 · 1 comment · May be fixed by #1366
Open

@ConfigProperty for java.util.Duration with defaultValue flagged as error #1207

fbricon opened this issue Oct 6, 2023 · 1 comment · May be fixed by #1366
Assignees
Labels
bug Something isn't working quarkus Quarkus support

Comments

@fbricon
Copy link
Contributor

fbricon commented Oct 6, 2023

same issue as redhat-developer/vscode-quarkus#631:

the following code generates an error:

    @ConfigProperty(name = "app.duration", defaultValue = "PT15M")
    Duration duration;

❌ The error message looks like that :

'PT15M' does not match the expected type of 'Duration'.microprofile-config(DEFAULT_VALUE_IS_WRONG_TYPE)
@fbricon fbricon added bug Something isn't working quarkus Quarkus support labels Oct 6, 2023
@fbricon fbricon self-assigned this Oct 17, 2023
@fbricon fbricon added this to the 1.29.0 milestone Oct 17, 2023
@fbricon
Copy link
Contributor Author

fbricon commented Oct 17, 2023

MicroProfileConfigASTValidator is Microprofile specific, but Quarkus projects use a specific DurationConverter.

MicroProfileConfigASTValidator would need to load converters in a dynamic way (using special classloader) then we could validate via reflection, but that's not a trivial solution.

Or we take the dirty road and simply copy DurationConverter over, use it directly in MicroProfileConfigASTValidator (since it's only used for Quarkus projects anyways) and fix this issue.

Duration conversion would still need to be implemented at the QuarkusConfigMappingProvider / QuarkusConfigPropertiesProvider / QuarkusConfigRootProvider level so duration properties can show up and be validated in application.properties

@fbricon fbricon removed this from the 1.29.0 milestone Oct 17, 2023
angelozerr added a commit to angelozerr/intellij-quarkus that referenced this issue Aug 12, 2024
angelozerr added a commit to angelozerr/intellij-quarkus that referenced this issue Aug 12, 2024
@angelozerr angelozerr changed the title @ConfigProperty for java.util.Duration with defaultValue flagged as error fix: @ConfigProperty for java.util.Duration with defaultValue flagged as error Aug 12, 2024
@angelozerr angelozerr changed the title fix: @ConfigProperty for java.util.Duration with defaultValue flagged as error @ConfigProperty for java.util.Duration with defaultValue flagged as error Aug 12, 2024
angelozerr added a commit to angelozerr/intellij-quarkus that referenced this issue Aug 12, 2024
angelozerr added a commit to angelozerr/intellij-quarkus that referenced this issue Aug 12, 2024
@angelozerr angelozerr added this to the 1.31.0 milestone Aug 12, 2024
@angelozerr angelozerr self-assigned this Aug 12, 2024
@angelozerr angelozerr moved this to 👀 In review in IDE Cloudaptors Aug 12, 2024
@angelozerr angelozerr modified the milestones: 2.0.0, 2.1.0 Aug 20, 2024
@fbricon fbricon modified the milestones: 2.0.1, 2.1.0 Aug 28, 2024
@angelozerr angelozerr modified the milestones: 2.0.2, 2.1.0 Aug 29, 2024
@angelozerr angelozerr removed this from the 2.1.0 milestone Dec 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working quarkus Quarkus support
Projects
Status: No status
2 participants