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

template.java.ResponseTemplate.vm Maven / Gradle / Ivy

package gaia.sdk

#if ($hasMutation)import gaia.sdk.response.type.Mutation$newLine#end
#if ($hasQuery)import gaia.sdk.response.type.Query$newLine#end
import com.fasterxml.jackson.annotation.JsonProperty
import com.fasterxml.jackson.annotation.JsonCreator

abstract class #capitalize($name)Response {

#if ($hasQuery)#*
    *##tab(4)data class QueryResponse @JsonCreator constructor($newLine#*
    *##tab(8)@JsonProperty("data") val data: Query? = null,$newLine#*
    *##tab(8)@JsonProperty("extensions")val extensions: #print("Map? = null"),$newLine#*
    *##tab(8)@JsonProperty("errors")val errors: #print("List? = null")): #capitalize($name)Response()$newLine##
#end

#if ($hasMutation)#*
    *##tab(4)data class MutationResponse @JsonCreator constructor($newLine#*
    *##tab(8)@JsonProperty("data") val data: Mutation? = null,$newLine#*
    *##tab(8)@JsonProperty("extensions") val extensions: #print("Map? = null"),$newLine#*
    *##tab(8)@JsonProperty("errors") val errors: #print("List? = null")): #capitalize($name)Response()$newLine##
#end

#tab(4)data class Error @JsonCreator constructor(
#tab(8)@JsonProperty("message") val message: String,
#tab(8)@JsonProperty("locations") val locations: Array?,
#tab(8)@JsonProperty("path") val path: Array?
#tab(4))

#tab(4)data class Location @JsonCreator constructor(
#tab(8)@JsonProperty("line") val line: Int,
#tab(8)@JsonProperty("column") val column: Int
#tab(4))

}
#macro(tab $indent)${tab.invoke($indent)}#end
#macro(print $text)${print.invoke($text)}#end
#macro(capitalize $str)${str.substring(0, 1).toUpperCase()}${str.substring(1)}#end




© 2015 - 2025 Weber Informatics LLC | Privacy Policy