-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
allow empty auth definitions in parser #111
Conversation
needed for v08 #70 |
fixes serverlessworkflow#110 Signed-off-by: spolti <filippespolti@gmail.com>
About the defs problem, there is another problem as well, see: https://gist.github.com/spolti/ac43ce2cc5a51532987259db4f9fa5b7 |
model/workflow.go
Outdated
@@ -108,7 +108,7 @@ type BaseWorkflow struct { | |||
// Auth definitions can be used to define authentication information that should be applied to resources defined in the operation | |||
// property of function definitions. It is not used as authentication information for the function invocation, | |||
// but just to access the resource containing the function invocation information. | |||
Auth AuthDefinitions `json:"auth,omitempty"` | |||
Auth *AuthDefinitions `json:"auth,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to the specification, should we directly change this field's type to []Auth?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, tried already, the problem is, if we do that we can't have strings :)
maybe declaring it as interface might help, let's see..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can do it in this way.
// First, we redefine the []Auth
type AuthArray []Auth
// Second, change struct field
Auth AuthArray
// Third, define UnmarshalJSON for AuthArray, and implement it
func (a *AuthArray) UnmarshalJSON(data []byte) error {
// Unmarshal it as string or array
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that could work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasn't able to get it working with this approach, however with interface it is fully working, including the fix for this issue and #126
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@davidesalerno f.y.i
0174926
to
659f342
Compare
fixes serverlessworkflow#110 fixes serverlessworkflow#126 Signed-off-by: spolti <filippespolti@gmail.com>
Signed-off-by: lsytj0413 <511121939@qq.com>
fix(*): use different types to auth validate
Signed-off-by: spolti <filippespolti@gmail.com>
/lgtm |
fixes #110
Signed-off-by: spolti filippespolti@gmail.com
Many thanks for submitting your Pull Request ❤️!
What this PR does / why we need it:
Special notes for reviewers:
Additional information (if needed):