de.lancom.openapi.tools.Schema.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of openapi-parser Show documentation
Show all versions of openapi-parser Show documentation
This open-source project provides an OpenAPI 3.0 Parser implemented in Kotlin, utilizing immutable data classes
package de.lancom.openapi.tools
import de.lancom.openapi.entity.Schema
import de.lancom.openapi.refs.Reference
val ARRAY_SCHEMA: Schema = Schema()
.addTypeArray()
val OBJECT_SCHEMA: Schema = Schema()
.addTypeObject()
val STRING_SCHEMA = Schema()
.addTypeString()
val NUMBER_SCHEMA = Schema()
.addTypeNumber()
val INT_SCHEMA = Schema()
.addTypeInteger()
val UUID_SCHEMA = STRING_SCHEMA
.addFormatUuid()
val INT32_SCHEMA = INT_SCHEMA
.addFormatInt32()
val INT64_SCHEMA = INT_SCHEMA
.addFormatInt64()
val STRING_ARRAY_SCHEMA = ARRAY_SCHEMA
.addItems(STRING_SCHEMA)
inline fun schemaRef(): Reference {
return schemaRef(T::class.simpleName!!)
}
fun schemaRef(typeName: String): Reference {
return Reference("#/components/schemas/$typeName")
}