You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
sanitizeValues() tries to mutate the input settings data, which is visible mostly for customAnnotationsMapping and directiveAnnotationsMapping; if the input data is immutable (e.g. supplied via mapOf() etc.), the result is a not-too-helpful UnsupportedOperationException.
The solution would be for the sanitization method to produce a mutated copy of the whole map instead, and re-assign that copy via mappingConfig.setDirectiveAnnotationsMapping() etc. instead of trying to mutate in place.
A worse solution would be to explicitly require a mutable input parameter (e.g. mutable map) in the affected cases, although this would be a serious code smell IMVHO.
Steps to Reproduce
directiveAnnotationsMapping = mapOf(
"foo" to listOf(
"@bar",
),
)
with Kotlin DSL e.g.
Expected Result
Should work.
Actual Result
UnsupportedOperationException due to attempted entry.setValue() on the map.
Your Environment and Setup
graphql-java-codegen version: 5.8.0
Build tool: Gradle 8.4
Mapping Config: see above
The text was updated successfully, but these errors were encountered:
@FyiurAmron, since you have already investigated this, would you be able to contribute? Otherwise, I might be able to pick this up some time next week.
Thanks!
@kobylynskyi honestly, hard to say. I'd gladly do a PR, since it looks simple enough, but the earliest time I'd be able to handle this would be around the end of the next week as well. If this was a blocker, I'd probably do it even tomorrow, but thankfully it isn't :D
Issue Description
sanitizeValues()
tries to mutate the input settings data, which is visible mostly forcustomAnnotationsMapping
anddirectiveAnnotationsMapping
; if the input data is immutable (e.g. supplied viamapOf()
etc.), the result is a not-too-helpfulUnsupportedOperationException
.The solution would be for the sanitization method to produce a mutated copy of the whole map instead, and re-assign that copy via
mappingConfig.setDirectiveAnnotationsMapping()
etc. instead of trying to mutate in place.A worse solution would be to explicitly require a mutable input parameter (e.g. mutable map) in the affected cases, although this would be a serious code smell IMVHO.
Steps to Reproduce
with Kotlin DSL e.g.
Expected Result
Should work.
Actual Result
UnsupportedOperationException
due to attemptedentry.setValue()
on the map.Your Environment and Setup
The text was updated successfully, but these errors were encountered: