You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
openapi: 3.1.0
info:
title: test
servers:
- url: /
components:
schemas:
Severity:
type: integer
oneOf:
- title: HIGH
const: 2
description: An urgent problem
- title: MEDIUM
const: 1
- title: LOW
const: 0
description: Can wait forever
it fails with the following error
Error:Unknown type for the following structure (No type definition, class: io.swagger.v3.oas.models.media.JsonSchema, .components.schemas.Severity):
Tracker(class JsonSchema {
class Schema {
type: [integer]
}
}, Vector(.components, .schemas, .Severity))
One could generate something similar to this instead
sealed abstract class Severity(val code: Int, val value: String) {
override def toString: String = value
}
object Severity {
object members {
case object HIGH extends Severity(2, "HIGH")
case object MEDIUM extends Severity(1, "MEDIUM")
case object LOW extends Severity(0, "LOW")
}
val HIGH: Severity = members.HIGH
val MEDIUM: Severity = members.MEDIUM
val LOW: Severity = members.LOW
val values = Vector(HIGH, MEDIUM, LOW)
}
The text was updated successfully, but these errors were encountered:
according to
https://stackoverflow.com/questions/66465888/how-to-define-enum-mapping-in-openapi
openapi 3.1 allows the following format for defining number backed enums
it fails with the following error
One could generate something similar to this instead
The text was updated successfully, but these errors were encountered: