-
Notifications
You must be signed in to change notification settings - Fork 118
runtime-v2: add github exclusive trigger to schema #977
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
Conversation
| @JsonInclude(JsonInclude.Include.NON_EMPTY) | ||
| @JsonSerialize(as = ImmutableDefaultExclusiveMode.class) | ||
| @JsonDeserialize(as = ImmutableDefaultExclusiveMode.class) | ||
| interface DefaultExclusiveMode extends ExclusiveMode { |
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.
Not sure why do we need a separate interface here? Does it change the serialization of TriggerMixIn?
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.
One @Immutable class should not extends another @Immutable class.
@Value.Immutable
public interface MyInterface {
boolean isTrue();
}
@Value.Immutable
public interface AnotherInterface extends MyInterface {
boolean isFalse();
}AnotherInterface.java: (immutables:subtype) Should not inherit com.example.MyInterface which is
a value type itself. Avoid extending from another abstract value type. Better to share common
abstract class or interface which are not carrying @Immutable annotation. If still extending from
immutable abstract type be ready to face some incoherences in generated types.
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.
Does it change the serialization of TriggerMixIn?
Is the concern in this question regarding somewhere we deserialize it from a value stored in the db? i.e. a value stored pre-upgrade may fail after this change is in?
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 misunderstood what was happening here, my bad.
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'm still not quite sure why a new class/interface appeared here...
Wouldn't it be enough to just change:
GithubTriggerMixIn:
@JsonProperty("exclusive")
ExclusiveMode exclusive();
to
@JsonProperty("exclusive")
GithubTriggerExclusiveMode exclusive();
?
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.
something like this:
@@ -111,7 +112,7 @@ public interface TriggerMixIn extends Trigger {
GithubTriggerConditions conditions();
@JsonProperty("exclusive")
- ExclusiveMode exclusive();
+ GithubTriggerExclusiveMode exclusive();
interface GithubTriggerConditions {
@JsonProperty(value = "type", required = true)
@@ -174,6 +175,9 @@ public interface TriggerMixIn extends Trigger {
@JsonProperty("conditions")
Map<String, Object> conditions();
+
+ @JsonProperty("exclusive")
+ ExclusiveMode exclusive();
}
}
@@ -187,8 +191,5 @@ public interface TriggerMixIn extends Trigger {
@JsonProperty("arguments")
Map<String, Object> arguments();
-
- @JsonProperty("exclusive")
- ExclusiveMode exclusive();
}
}
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.
Not sure if that would be reflected in the resulting schema?
Currently (with the PRs changes), it's
"triggers" : {
"type" : "array",
"items" : {
"oneOf" : [ {
"$ref" : "#/definitions/GenericTrigger"
}, {
"$ref" : "#/definitions/CronTrigger"
}, {
"$ref" : "#/definitions/ManualTrigger"
}, {
"$ref" : "#/definitions/GithubTrigger"
}, {
"$ref" : "#/definitions/OneOpsTrigger"
} ]
}
}With GithubTrigger containing
"GithubTriggerParams" : {
"type" : "object",
"additionalProperties" : false,
"properties" : {
"version" : {
"type" : "integer",
"enum" : [ 2 ]
},
"exclusive" : {
"$ref" : "#/definitions/GithubTriggerExclusiveMode"
},
...and other trigger types using the base ExclusiveMode:
"ManualTriggerParams" : {
"type" : "object",
"additionalProperties" : false,
"properties" : {
"name" : {
"type" : "string"
},
"arguments" : {
"type" : "object"
},
"activeProfiles" : {
"type" : "array",
"items" : {
"type" : "string"
}
},
"entryPoint" : {
"type" : "string"
},
"exclusive" : {
"$ref" : "#/definitions/ExclusiveMode"
}
},
"required" : [ "entryPoint" ]
},Which seems fine to me?
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.
Not sure if that would be reflected in the resulting schema?
It should be, why not?
from master branch:
...
"GithubTriggerParams" : {
...
"exclusive" : {
"$ref" : "#/definitions/ExclusiveMode"
},
....
with just ExclusiveMode -> GithubTriggerExclusiveMode change:
...
"GithubTriggerParams" : {
...
"exclusive" : {
"$ref" : "#/definitions/GithubTriggerExclusiveMode"
},
....
"GithubTriggerExclusiveMode" : {
"type" : "object",
"additionalProperties" : false,
"properties" : {
"group" : {
"type" : "string"
},
"groupBy" : {
"type" : "string"
},
"mode" : {
"type" : "string",
"enum" : [ "cancel", "cancelOld", "wait" ]
}
}
}
|
@brig should we mark GithubTriggerExclusiveMode#group and #groupBy fields as @Deprecated? |
|
On a separate note, I don't think this is right? "ManualTrigger" : {
"type" : "object",
"additionalProperties" : false,
"properties" : {
"manual" : {
"$ref" : "#/definitions/ManualTriggerParams"
},
"exclusive" : {
"$ref" : "#/definitions/ExclusiveMode"
}
},
"title" : "Manual Trigger"
},
"ManualTriggerParams" : {
"type" : "object",
"additionalProperties" : false,
"properties" : {
"name" : {
"type" : "string"
},
"arguments" : {
"type" : "object"
},
"activeProfiles" : {
"type" : "array",
"items" : {
"type" : "string"
}
},
"entryPoint" : {
"type" : "string"
},
"exclusive" : {
"$ref" : "#/definitions/ExclusiveMode"
}
},
"required" : [ "entryPoint" ]
},Why both ManualTrigger and ManualTriggerParams have |
yep :( this lines should be in |
groupBycurrently isn't represented in the runtime-v2 json schema.