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.RouteMeta
import org.http4k.core.Method
import java.util.Locale.getDefault

fun operationId(routeMeta: RouteMeta, method: Method, description: String) =
    routeMeta.operationId ?: (method.name.lowercase(getDefault()) + description
        .split('/')
        .joinToString("") { it.replaceFirstChar { if (it.isLowerCase()) it.titlecase(getDefault()) else it.toString() } }
        .replace('{', '_').replace('}', '_').replace('-', '_').trimEnd('_'))




© 2015 - 2024 Weber Informatics LLC | Privacy Policy