mirror of
https://github.com/LukeHagar/libopenapi.git
synced 2025-12-09 20:47:44 +00:00
Refactored version directory names
3.0 and 2.0 do not work, there are multiple versions and anything with a period in it sucks from my point of view, v2 and v3 feel much better from a DX perspective.
This commit is contained in:
32
datamodel/high/v3/server_variable.go
Normal file
32
datamodel/high/v3/server_variable.go
Normal file
@@ -0,0 +1,32 @@
|
||||
// Copyright 2022 Princess B33f Heavy Industries / Dave Shanley
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
package v3
|
||||
|
||||
import low "github.com/pb33f/libopenapi/datamodel/low/v3"
|
||||
|
||||
type ServerVariable struct {
|
||||
Enum []string
|
||||
Default string
|
||||
Description string
|
||||
low *low.ServerVariable
|
||||
}
|
||||
|
||||
func NewServerVariable(variable *low.ServerVariable) *ServerVariable {
|
||||
v := new(ServerVariable)
|
||||
v.low = variable
|
||||
var enums []string
|
||||
for _, enum := range variable.Enum {
|
||||
if enum.Value != "" {
|
||||
enums = append(enums, enum.Value)
|
||||
}
|
||||
}
|
||||
v.Default = variable.Default.Value
|
||||
v.Description = variable.Description.Value
|
||||
v.Enum = enums
|
||||
return v
|
||||
}
|
||||
|
||||
func (s *ServerVariable) GoLow() *low.ServerVariable {
|
||||
return s.low
|
||||
}
|
||||
Reference in New Issue
Block a user