Skip to content

Instantly share code, notes, and snippets.

@jimschubert
Created November 1, 2017 20:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jimschubert/6522f2327a05c8ea363b3429da0a9543 to your computer and use it in GitHub Desktop.
Save jimschubert/6522f2327a05c8ea363b3429da0a9543 to your computer and use it in GitHub Desktop.
Kotlin enum testing for Swagger Codegen
/**
* Reserved Words Issue
* A sample of reserved words being escaped and breaking serialization
*
* OpenAPI spec version: 1.0.0
*
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
package io.swagger.client.models
/**
*
* @param id
* @param name
* @param path
* @param _lazy
* @param match
* @param type
* @param sample
*/
data class Example (
val id: kotlin.Long,
val name: kotlin.String,
val path: kotlin.String,
val _lazy: kotlin.Boolean? = null,
val match: kotlin.Long? = null,
val type: kotlin.String? = null,
val sample: Example.Sample? = null
) {
/**
*
* Values: `as`,asQuestionMark,`break`,`class`,`continue`,`do`,`else`,`false`,`for`,`fun`,`if`,`in`,exclamationin,`interface`,`is`,exclamationis,`null`,`object`,`package`,`return`,`super`,`this`,`throw`,`true`,`try`,`typealias`,`val`,`var`,`when`,`while`,by,`catch`,`constructor`,`delegate`,dynamic,field,file,`finally`,import,`init`,param,property,receiver,set,setparam,where,`abstract`,`annotation`,`companion`,`const`,`crossinline`,`data`,`enum`,`external`,`final`,`infix`,`inline`,`inner`,`internal`,`lateinit`,`noinline`,`open`,`operator`,`out`,`override`,`private`,`protected`,`public`,`reified`,`sealed`,`suspend`,`tailrec`,`vararg`,`it`,plus,minus,star,slash,percent,equal,plusEqual,minusEqual,starEqual,slashEqual,percentEqual,plusPlus,minusMinus,ampersandAmpersand,pipePipe,exclamation,equalEqual,exclamationEqual,equalsLeftParenthesisRightParenthesis,equalEqualEqual,exclamationEqualEqual,lessThan,greaterThan,lessThanOrEqualTo,greaterThanEqual,compareToLeftParenthesisRightParenthesis,leftSquareBracket,rightSquareBracket,get,exclamationExclamation,questionMarkPeriod,questionMarkColon,colonColon,periodPeriod,colon,questionMark,minusGreaterThan,at,semicolon,dollar,underscore
*/
enum class Sample(val value: kotlin.Any){
`as`("as"),
asQuestionMark("as?"),
`break`("break"),
`class`("class"),
`continue`("continue"),
`do`("do"),
`else`("else"),
`false`("false"),
`for`("for"),
`fun`("fun"),
`if`("if"),
`in`("in"),
exclamationin("!in"),
`interface`("interface"),
`is`("is"),
exclamationis("!is"),
`null`("null"),
`object`("object"),
`package`("package"),
`return`("return"),
`super`("super"),
`this`("this"),
`throw`("throw"),
`true`("true"),
`try`("try"),
`typealias`("typealias"),
`val`("val"),
`var`("var"),
`when`("when"),
`while`("while"),
by("by"),
`catch`("catch"),
`constructor`("constructor"),
`delegate`("delegate"),
dynamic("dynamic"),
field("field"),
file("file"),
`finally`("finally"),
import("import"),
`init`("init"),
param("param"),
property("property"),
receiver("receiver"),
set("set"),
setparam("setparam"),
where("where"),
`abstract`("abstract"),
`annotation`("annotation"),
`companion`("companion"),
`const`("const"),
`crossinline`("crossinline"),
`data`("data"),
`enum`("enum"),
`external`("external"),
`final`("final"),
`infix`("infix"),
`inline`("inline"),
`inner`("inner"),
`internal`("internal"),
`lateinit`("lateinit"),
`noinline`("noinline"),
`open`("open"),
`operator`("operator"),
`out`("out"),
`override`("override"),
`private`("private"),
`protected`("protected"),
`public`("public"),
`reified`("reified"),
`sealed`("sealed"),
`suspend`("suspend"),
`tailrec`("tailrec"),
`vararg`("vararg"),
`it`("it"),
plus("+"),
minus("-"),
star("*"),
slash("/"),
percent("%"),
equal("="),
plusEqual("+="),
minusEqual("-="),
starEqual("*="),
slashEqual("/="),
percentEqual("%="),
plusPlus("++"),
minusMinus("--"),
ampersandAmpersand("&&"),
pipePipe("||"),
exclamation("!"),
equalEqual("=="),
exclamationEqual("!="),
equalsLeftParenthesisRightParenthesis("equals()"),
equalEqualEqual("==="),
exclamationEqualEqual("!=="),
lessThan("<"),
greaterThan(">"),
lessThanOrEqualTo("<="),
greaterThanEqual(">="),
compareToLeftParenthesisRightParenthesis("compareTo()"),
leftSquareBracket("["),
rightSquareBracket("]"),
get("get"),
exclamationExclamation("!!"),
questionMarkPeriod("?."),
questionMarkColon("?:"),
colonColon("::"),
periodPeriod(".."),
colon(":"),
questionMark("?"),
minusGreaterThan("->"),
at("@"),
semicolon(";"),
dollar("$"),
underscore("_");
}
}
{
"swagger": "2.0",
"info": {
"version": "1.0.0",
"title": "Reserved Words Issue",
"description": "A sample of reserved words being escaped and breaking serialization",
"termsOfService": "http://swagger.io/terms/",
"contact": {
"name": "Jim Schubert"
},
"license": {
"name": "MIT"
}
},
"host": "example.com",
"basePath": "/api",
"schemes": [
"http"
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"paths": {
"/hi": {
"get": {
"description": "Returns all examples",
"produces": [
"application/json"
],
"responses": {
"200": {
"description": "A list of examples.",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/Example"
}
}
}
}
}
}
},
"definitions": {
"Example": {
"type": "object",
"required": [
"id",
"name",
"path"
],
"properties": {
"id": {
"type": "integer",
"format": "int64"
},
"name": {
"type": "string"
},
"path": {
"type": "string"
},
"lazy": {
"type": "boolean"
},
"match": {
"type": "integer",
"format": "int64"
},
"type": {
"type": "string"
},
"sample": {
"type": "string",
"enum": [
"as",
"as?",
"break",
"class",
"continue",
"do",
"else",
"false",
"for",
"fun",
"if",
"in",
"!in",
"interface",
"is",
"!is",
"null",
"object",
"package",
"return",
"super",
"this",
"throw",
"true",
"try",
"typealias",
"val",
"var",
"when",
"while",
"by",
"catch",
"constructor",
"delegate",
"dynamic",
"field",
"file",
"finally",
"import",
"init",
"param",
"property",
"receiver",
"set",
"setparam",
"where",
"abstract",
"annotation",
"companion",
"const",
"crossinline",
"data",
"enum",
"external",
"final",
"infix",
"inline",
"inner",
"internal",
"lateinit",
"noinline",
"open",
"operator",
"out",
"override",
"private",
"protected",
"public",
"reified",
"sealed",
"suspend",
"tailrec",
"vararg",
"it",
"+",
"-",
"*",
"/",
"%",
"=",
"+=",
"-=",
"*=",
"/=",
"%=",
"++",
"--",
"&&",
"||",
"!",
"==",
"!=",
"equals()",
"===",
"!==",
"<",
">",
"<=",
">=",
"compareTo()",
"[",
"]",
"get",
"!!",
"?.",
"?:",
"::",
"..",
":",
"?",
"->",
"@",
";",
"$",
"_"
]
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment