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

io.vrap.codegen.languages.go.GoVrapExtensions.kt Maven / Gradle / Ivy

Go to download

RAML API client code generators based on the REST Modeling Framework. https://github.com/vrapio/rest-modeling-framework

The newest version!
package io.vrap.codegen.languages.go

import io.vrap.rmf.codegen.types.*

fun VrapType.goTypeName(): String {
    return when (this) {
        is VrapAnyType -> this.baseType
        is VrapScalarType -> this.scalarType
        is VrapEnumType -> this.simpleClassName.exportName()
        is VrapObjectType -> this.simpleClassName.exportName()
        is VrapArrayType -> "[]${this.itemType.goTypeName()}"
        is VrapNilType -> "nil"
    }
}

fun VrapType.simpleGoName(): String {
    return when (this) {
        is VrapAnyType -> this.baseType
        is VrapScalarType -> this.scalarType
        is VrapEnumType -> this.simpleClassName.exportName()
        is VrapObjectType -> this.simpleClassName.exportName()
        is VrapArrayType -> this.itemType.simpleGoName()
        is VrapNilType -> "nil"
    }
}

fun VrapType.flattenVrapType(): VrapType {
    return when (this) {
        is VrapArrayType -> {
            this.itemType.flattenVrapType()
        }
        else -> this
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy