mirror of
https://github.com/LukeHagar/libopenapi.git
synced 2025-12-07 20:47:45 +00:00
41 lines
1.0 KiB
Go
41 lines
1.0 KiB
Go
package v3
|
|
|
|
import (
|
|
"github.com/pb33f/libopenapi/datamodel/low"
|
|
"gopkg.in/yaml.v3"
|
|
)
|
|
|
|
type OAuthFlows struct {
|
|
Implicit low.NodeReference[*OAuthFlow]
|
|
Password low.NodeReference[*OAuthFlow]
|
|
ClientCredentials low.NodeReference[*OAuthFlow]
|
|
AuthorizationCode low.NodeReference[*OAuthFlow]
|
|
Extensions map[low.KeyReference[string]]low.ValueReference[any]
|
|
}
|
|
|
|
func (o *OAuthFlows) Build(root *yaml.Node) error {
|
|
extensionMap, err := ExtractExtensions(root)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
o.Extensions = extensionMap
|
|
return nil
|
|
}
|
|
|
|
type OAuthFlow struct {
|
|
AuthorizationUrl low.NodeReference[string]
|
|
TokenURL low.NodeReference[string]
|
|
RefreshURL low.NodeReference[string]
|
|
Scopes map[low.KeyReference[string]]low.ValueReference[string]
|
|
Extensions map[low.KeyReference[string]]low.ValueReference[any]
|
|
}
|
|
|
|
func (o *OAuthFlow) Build(root *yaml.Node) error {
|
|
extensionMap, err := ExtractExtensions(root)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
o.Extensions = extensionMap
|
|
return nil
|
|
}
|