diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java index bade86348d6d..731115881f00 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java @@ -66,6 +66,7 @@ import org.openapitools.codegen.utils.OneOfImplementorAdditionalData; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import static org.openapitools.codegen.utils.OnceLogger.once; import java.io.File; import java.util.*; @@ -1654,7 +1655,7 @@ public void setParameterExampleValue(CodegenParameter codegenParameter, RequestB if (content.size() > 1) { // @see ModelUtils.getSchemaFromContent() - LOGGER.warn("Multiple MediaTypes found, using only the first one"); + once(LOGGER).warn("Multiple MediaTypes found, using only the first one"); } MediaType mediaType = content.values().iterator().next(); @@ -3530,7 +3531,7 @@ public CodegenParameter fromParameter(Parameter parameter, Set imports) } else if (parameter.getContent() != null) { Content content = parameter.getContent(); if (content.size() > 1) { - LOGGER.warn("Multiple schemas found in content, returning only the first one"); + once(LOGGER).warn("Multiple schemas found in content, returning only the first one"); } MediaType mediaType = content.values().iterator().next(); s = mediaType.getSchema(); @@ -3884,7 +3885,7 @@ public List fromSecurity(Map securitySc // As of January 2020, the "signature" scheme has not been registered with IANA yet. // This scheme may have to be changed when it is officially registered with IANA. cs.isHttpSignature = true; - LOGGER.warn("Security scheme 'HTTP signature' is a draft IETF RFC and subject to change."); + once(LOGGER).warn("Security scheme 'HTTP signature' is a draft IETF RFC and subject to change."); } } else if (SecurityScheme.Type.OAUTH2.equals(securityScheme.getType())) { cs.isKeyInHeader = cs.isKeyInQuery = cs.isKeyInCookie = cs.isApiKey = cs.isBasic = false; diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/ModelUtils.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/ModelUtils.java index 44373cd8c3bd..e55479e4a31f 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/ModelUtils.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/ModelUtils.java @@ -985,7 +985,7 @@ private static Schema getSchemaFromContent(Content content) { if (content.size() > 1) { // Other content types are currently ignored by codegen. If you see this warning, // reorder the OAS spec to put the desired content type first. - LOGGER.warn("Multiple schemas found in the OAS 'content' section, returning only the first one ({})", + once(LOGGER).warn("Multiple schemas found in the OAS 'content' section, returning only the first one ({})", entry.getKey()); } return entry.getValue().getSchema();