All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.http4k.contract.openapi.ext.kt Maven / Gradle / Ivy

There is a newer version: 5.31.0.0
Show newest version
package org.http4k.contract.openapi

import org.http4k.contract.ContractRoute
import org.http4k.contract.PathSegments
import java.util.Locale.getDefault

fun ContractRoute.operationId(contractRoot: PathSegments) =
    meta.operationId ?: (method.name.lowercase(getDefault()) + describeFor(contractRoot)
        .split('/')
        .joinToString("") { it.replaceFirstChar { if (it.isLowerCase()) it.titlecase(getDefault()) else it.toString() } }
        .replace('{', '_').replace('}', '_').trimEnd('_'))




© 2015 - 2024 Weber Informatics LLC | Privacy Policy