mirror of
https://github.com/LukeHagar/libopenapi.git
synced 2025-12-06 12:37:49 +00:00
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.
44 lines
1.0 KiB
Go
44 lines
1.0 KiB
Go
// Copyright 2022 Princess B33f Heavy Industries / Dave Shanley
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package v3
|
|
|
|
import (
|
|
"github.com/pb33f/libopenapi/datamodel/high"
|
|
low "github.com/pb33f/libopenapi/datamodel/low/v3"
|
|
)
|
|
|
|
type SecurityScheme struct {
|
|
Type string
|
|
Description string
|
|
Name string
|
|
In string
|
|
Scheme string
|
|
BearerFormat string
|
|
Flows *OAuthFlows
|
|
OpenIdConnectUrl string
|
|
Extensions map[string]any
|
|
low *low.SecurityScheme
|
|
}
|
|
|
|
func NewSecurityScheme(ss *low.SecurityScheme) *SecurityScheme {
|
|
s := new(SecurityScheme)
|
|
s.low = ss
|
|
s.Type = ss.Type.Value
|
|
s.Description = ss.Description.Value
|
|
s.Name = ss.Name.Value
|
|
s.Scheme = ss.Scheme.Value
|
|
s.In = ss.In.Value
|
|
s.BearerFormat = ss.BearerFormat.Value
|
|
s.OpenIdConnectUrl = ss.OpenIdConnectUrl.Value
|
|
s.Extensions = high.ExtractExtensions(ss.Extensions)
|
|
if !ss.Flows.IsEmpty() {
|
|
s.Flows = NewOAuthFlows(ss.Flows.Value)
|
|
}
|
|
return s
|
|
}
|
|
|
|
func (s *SecurityScheme) GoLow() *low.SecurityScheme {
|
|
return s.low
|
|
}
|