Skip to content

Commit

Permalink
Merge pull request #42758 from franz1981/single_enum_converter
Browse files Browse the repository at this point in the history
Single enum converter
  • Loading branch information
gsmet authored Aug 26, 2024
2 parents de779d8 + 11ee476 commit 9926830
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
*/
public class OpenApiConfigMapping extends RelocateConfigSourceInterceptor {
private static final Map<String, String> RELOCATIONS = relocations();
private final Converter<OperationIdStrategy> enumConverter = Converters.getImplicitConverter(OperationIdStrategy.class);
private static final Converter<OperationIdStrategy> OPERATION_ID_STRATEGY_CONVERTER = Converters
.getImplicitConverter(OperationIdStrategy.class);

public OpenApiConfigMapping() {
super(RELOCATIONS);
Expand All @@ -32,7 +33,7 @@ public ConfigValue getValue(ConfigSourceInterceptorContext context, String name)
// Special case for enum. The converter run after the interceptors, so we have to do this here.
if (name.equals(io.smallrye.openapi.api.constants.OpenApiConstants.OPERATION_ID_STRAGEGY)) {
if (configValue != null) {
String correctValue = enumConverter.convert(configValue.getValue()).toString();
String correctValue = OPERATION_ID_STRATEGY_CONVERTER.convert(configValue.getValue()).toString();
configValue = configValue.withValue(correctValue);
}
}
Expand Down

0 comments on commit 9926830

Please sign in to comment.