Files
libopenapi/datamodel/high/v3/server.go
Dave Shanley 3d5ecf0efb 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.
2022-09-16 08:33:39 -04:00

31 lines
670 B
Go

// Copyright 2022 Princess B33f Heavy Industries / Dave Shanley
// SPDX-License-Identifier: MIT
package v3
import low "github.com/pb33f/libopenapi/datamodel/low/v3"
type Server struct {
URL string
Description string
Variables map[string]*ServerVariable
low *low.Server
}
func NewServer(server *low.Server) *Server {
s := new(Server)
s.low = server
s.Description = server.Description.Value
s.URL = server.URL.Value
vars := make(map[string]*ServerVariable)
for k, val := range server.Variables.Value {
vars[k.Value] = NewServerVariable(val.Value)
}
s.Variables = vars
return s
}
func (s *Server) GoLow() *low.Server {
return s.low
}