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

de.lancom.openapi.tools.Schema.kt Maven / Gradle / Ivy

Go to download

This open-source project provides an OpenAPI 3.0 Parser implemented in Kotlin, utilizing immutable data classes

There is a newer version: 2.1.1
Show newest version
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")
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy