Skip to content

Commit

Permalink
Removing warning log message. (#80)
Browse files Browse the repository at this point in the history
* Removing warning log message.

* formatting
  • Loading branch information
cjbooms authored Aug 18, 2021
1 parent cc687ac commit 69deee7
Showing 1 changed file with 8 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ import com.squareup.kotlinpoet.TypeSpec
import com.squareup.kotlinpoet.asTypeName
import java.io.Serializable
import java.net.URL
import java.util.logging.Logger

class JacksonModelGenerator(
private val packages: Packages,
Expand Down Expand Up @@ -116,23 +115,18 @@ class JacksonModelGenerator(
}

private fun toClassName(basePackage: String, typeInfo: KotlinTypeInfo): ClassName =
if (typeInfo.modelKClass == GeneratedType::class)
generatedType(
basePackage,
typeInfo.generatedModelClassName!!
)
else if (typeInfo is KotlinTypeInfo.MapTypeAdditionalProperties)
generatedType(
basePackage,
typeInfo.parameterizedType.generatedModelClassName!!
)
else typeInfo.modelKClass.asTypeName()
when {
typeInfo.modelKClass == GeneratedType::class ->
generatedType(basePackage, typeInfo.generatedModelClassName!!)
typeInfo is KotlinTypeInfo.MapTypeAdditionalProperties ->
generatedType(basePackage, typeInfo.parameterizedType.generatedModelClassName!!)
else -> typeInfo.modelKClass.asTypeName()
}

fun generatedType(basePackage: String, modelName: String) = ClassName(modelsPackage(basePackage), modelName)
}

private val externalApiSchemas = mutableMapOf<String, MutableSet<String>>()
private val logger = Logger.getGlobal()

fun generate(): Models {
val models: MutableSet<TypeSpec> = createModels(sourceApi.openApi3, sourceApi.allSchemas)
Expand Down Expand Up @@ -267,10 +261,7 @@ class JacksonModelGenerator(

private fun Schema.getDocumentUrl(): String {
val positionInfo = Overlay.of(this).positionInfo?.orElse(null)
return positionInfo?.documentUrl ?: run {
logger.warning("Could not find document URL in PositionInfo: $positionInfo")
"UNKNOWN"
}
return positionInfo?.documentUrl ?: "Not Found"
}

private fun Schema.nestedSchemas() =
Expand Down

0 comments on commit 69deee7

Please sign in to comment.