mirror of
https://github.com/LukeHagar/libopenapi.git
synced 2025-12-10 12:37:48 +00:00
Operartion model is now complete!
That should be the largest bulk of complexity, now onto components.
This commit is contained in:
@@ -5,6 +5,13 @@ import (
|
||||
"gopkg.in/yaml.v3"
|
||||
)
|
||||
|
||||
const (
|
||||
ImplicitLabel = "implicit"
|
||||
PasswordLabel = "password"
|
||||
ClientCredentialsLabel = "clientCredentials"
|
||||
AuthorizationCodeLabel = "authorizationCode"
|
||||
)
|
||||
|
||||
type OAuthFlows struct {
|
||||
Implicit low.NodeReference[*OAuthFlow]
|
||||
Password low.NodeReference[*OAuthFlow]
|
||||
@@ -19,7 +26,32 @@ func (o *OAuthFlows) Build(root *yaml.Node) error {
|
||||
return err
|
||||
}
|
||||
o.Extensions = extensionMap
|
||||
|
||||
v, vErr := ExtractObject[*OAuthFlow](ImplicitLabel, root)
|
||||
if vErr != nil {
|
||||
return vErr
|
||||
}
|
||||
o.Implicit = v
|
||||
|
||||
v, vErr = ExtractObject[*OAuthFlow](PasswordLabel, root)
|
||||
if vErr != nil {
|
||||
return vErr
|
||||
}
|
||||
o.Password = v
|
||||
|
||||
v, vErr = ExtractObject[*OAuthFlow](ClientCredentialsLabel, root)
|
||||
if vErr != nil {
|
||||
return vErr
|
||||
}
|
||||
o.ClientCredentials = v
|
||||
|
||||
v, vErr = ExtractObject[*OAuthFlow](AuthorizationCodeLabel, root)
|
||||
if vErr != nil {
|
||||
return vErr
|
||||
}
|
||||
o.AuthorizationCode = v
|
||||
return nil
|
||||
|
||||
}
|
||||
|
||||
type OAuthFlow struct {
|
||||
|
||||
Reference in New Issue
Block a user