Skip to content

Commit

Permalink
chore: Add type info to action schema descriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
rsenden committed May 14, 2024
1 parent 5f6fafd commit a25f68a
Show file tree
Hide file tree
Showing 17 changed files with 71 additions and 71 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@
@Reflectable @NoArgsConstructor
@Data
public abstract class AbstractActionStep implements IActionStep {
@JsonPropertyDescription("Optional: Only execute this step if the given if-expression evaluates to 'true'")
@JsonPropertyDescription("Optional SpEL template expression: Only execute this step if the given if-expression evaluates to 'true'")
@JsonProperty(value = "if", required = false) private TemplateExpression _if;
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@
@Reflectable @NoArgsConstructor
@Data @EqualsAndHashCode(callSuper = true)
public abstract class AbstractActionStepForEach extends AbstractActionStep {
@JsonPropertyDescription("Required: Name to assign to each individual record being processed. Can be referenced in other forEach properties and nested steps using ${name}.")
@JsonPropertyDescription("Required string: Name to assign to each individual record being processed. Can be referenced in other forEach properties and nested steps using ${name}.")
@JsonProperty(required = true) private String name;

@JsonPropertyDescription("Required: Steps to be executed for each individual record.")
@JsonPropertyDescription("Required list: Steps to be executed for each individual record.")
@JsonProperty(value = "do", required = true) private List<ActionStep> _do;

@JsonPropertyDescription("Optional: Stop processing any further records if the breakIf expression evaluates to 'true'.")
@JsonPropertyDescription("Optional SpEL template expression: Stop processing any further records if the breakIf expression evaluates to 'true'.")
@JsonProperty(required = false) private TemplateExpression breakIf;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@
@Reflectable @NoArgsConstructor
@Data @EqualsAndHashCode(callSuper = true)
public abstract class AbstractActionStepUpdateProperty extends AbstractActionStep implements IActionStepValueSupplier {
@JsonPropertyDescription("Required: Name to assign to the outcome of this operation. Can be referenced in subsequent steps using ${name}.")
@JsonPropertyDescription("Required string: Name to assign to the outcome of this operation. Can be referenced in subsequent steps using ${name}.")
@JsonProperty(required = true) private String name;

@JsonPropertyDescription("Required if 'valueTemplate' is not specified: Value to be assigned or appended to the given name.")
@JsonPropertyDescription("Required SpEL template expression if 'valueTemplate' is not specified: Value to be assigned or appended to the given name.")
@JsonProperty(required = false) private TemplateExpression value;

@JsonPropertyDescription("Required if 'value' is not specified: Name of a value template to be evaluated, assigning or appending the outcome of the value template to the given set/append name.")
@JsonPropertyDescription("Required string if 'value' is not specified: Name of a value template to be evaluated, assigning or appending the outcome of the value template to the given set/append name.")
@JsonProperty(required = false) private String valueTemplate;

public final void postLoad(Action action) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,34 +56,34 @@
@Data
@JsonClassDescription("Fortify CLI action definition")
public class Action implements IActionElement {
@JsonPropertyDescription("Read-only: Action name, inferred from file name.")
@JsonPropertyDescription("Read-only string: Action name, inferred from file name.")
@JsonProperty(access = Access.READ_ONLY) private String name;

@JsonPropertyDescription("Read-only: Whether this is a custom action, inferred from where the action is loaded from.")
@JsonPropertyDescription("Read-only boolean: Whether this is a custom action, inferred from where the action is loaded from.")
@JsonProperty(access = Access.READ_ONLY) private boolean custom;

@JsonPropertyDescription("Read-only: Action signature verification status.")
@JsonPropertyDescription("Read-only object: Action signature verification status.")
@JsonProperty(access = Access.READ_ONLY) private SignatureStatus signatureStatus;

@JsonPropertyDescription("Required unless `yaml-language-server` comment with schema location is provided: Schema location.")
@JsonPropertyDescription("Required string unless `yaml-language-server` comment with schema location is provided: Schema location.")
@JsonProperty(value = "$schema", required=false) public String schema;

@JsonPropertyDescription("Required: Action usage help.")
@JsonPropertyDescription("Required object: Action usage help.")
@JsonProperty(required = true) private ActionUsage usage;

@JsonPropertyDescription("Optional: Action parameters.")
@JsonPropertyDescription("Optional list: Action parameters.")
@JsonProperty(required = false) private List<ActionParameter> parameters;

@JsonPropertyDescription("Optional: Add target URLs and related properties for REST requests.")
@JsonPropertyDescription("Optional list: Add target URLs and related properties for REST requests.")
@JsonProperty(required = false) private List<ActionRequestTarget> addRequestTargets;

@JsonPropertyDescription("Optional: Default values for some specific properties. Currently only used to set a default request target.")
@JsonPropertyDescription("Optional object: Default values for some specific properties. Currently only used to set a default request target.")
@JsonProperty(required = false) private ActionDefaultValues defaults;

@JsonPropertyDescription("Required: Steps to be executed when this action is being run.")
@JsonPropertyDescription("Required list: Steps to be executed when this action is being run.")
@JsonProperty(required = true) private List<ActionStep> steps;

@JsonPropertyDescription("Optional: Value templates used to format data.")
@JsonPropertyDescription("Optional list: Value templates used to format data.")
@JsonProperty(required = false) private List<ActionValueTemplate> valueTemplates;

/** Maps/Collections listing action elements.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
@Reflectable @NoArgsConstructor
@Data
public final class ActionDefaultValues implements IActionElement {
@JsonPropertyDescription("Optional: Default request target to use for REST requests.")
@JsonPropertyDescription("Optional string: Default request target to use for REST requests.")
@JsonProperty(required = false) private String requestTarget;

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,25 +29,25 @@
@Reflectable @NoArgsConstructor
@Data
public final class ActionParameter implements IActionElement {
@JsonPropertyDescription("Required: Action parameter name. This will allow the action to accept CLI options named '--<name>' or '-<name>' for single-letter names. Parameter value can be referenced through ${parameters.name} in SpEL template expressions.")
@JsonPropertyDescription("Required string: Action parameter name. This will allow the action to accept CLI options named '--<name>' or '-<name>' for single-letter names. Parameter value can be referenced through ${parameters.name} in SpEL template expressions.")
@JsonProperty(required = true) private String name;

@JsonPropertyDescription("Required: Action parameter description to be shown in action usage help.")
@JsonPropertyDescription("Required string: Action parameter description to be shown in action usage help.")
@JsonProperty(required = true) private String description;

@JsonPropertyDescription("Optional: Comma-separated CLI option aliases. This will allow the action to accept CLI options named '--alias' or '-alias' for single-letter aliases. Aliases cannot be referenced in SpEL expressions.")
@JsonPropertyDescription("Optional string: Comma-separated CLI option aliases. This will allow the action to accept CLI options named '--alias' or '-alias' for single-letter aliases. Aliases cannot be referenced in SpEL expressions.")
@JsonProperty(required = false) private String cliAliases;

@JsonPropertyDescription("Optional: Action parameter type. Supported types depends on the fcli module (SSC/FoD) from which the action is being run. See built-in actions for examples of supported types.")
@JsonPropertyDescription("Optional string: Action parameter type. Supported types depends on the fcli module (SSC/FoD) from which the action is being run. See built-in actions for examples of supported types.")
@JsonProperty(required = false) private String type;

@JsonPropertyDescription("Optional: Action parameter type parameters to allow for additional configuration of the type converter configured through 'type'.")
@JsonPropertyDescription("Optional map<string,SpEL template expression>: Action parameter type parameters to allow for additional configuration of the type converter configured through 'type'.")
@JsonProperty(required = false) private Map<String, TemplateExpression> typeParameters;

@JsonPropertyDescription("Optional: Default value for this action parameter if no value is specified by the user.")
@JsonPropertyDescription("Optional SpEL template expression: Default value for this action parameter if no value is specified by the user.")
@JsonProperty(required = false) private TemplateExpression defaultValue;

@JsonPropertyDescription("Optional: All parameters are required by default, unless this property is set to false.")
@JsonPropertyDescription("Optional boolean: All parameters are required by default, unless this property is set to false.")
@JsonProperty(required = false, defaultValue = "true") private boolean required = true;

public final void postLoad(Action action) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@
@Reflectable @NoArgsConstructor
@Data
public final class ActionRequestTarget implements IActionElement {
@JsonPropertyDescription("Required: Request target name, referenceable from 'request' steps.")
@JsonPropertyDescription("Required string: Request target name, referenceable from 'request' steps.")
@JsonProperty(required = true) private String name;

@JsonPropertyDescription("Required: Base URL to use for REST requests to this request target.")
@JsonPropertyDescription("Required SpEL template expression: Base URL to use for REST requests to this request target.")
@JsonProperty(required = true) private TemplateExpression baseUrl;

@JsonPropertyDescription("Optional: Headers to be sent to this request target on every request.")
@JsonPropertyDescription("Optional map<string,SpEL template expression>: Headers to be sent to this request target on every request.")
@JsonProperty(required = false) private Map<String, TemplateExpression> headers;

// TODO Add support for next page URL producer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,46 +43,46 @@
@Reflectable @NoArgsConstructor
@Data @EqualsAndHashCode(callSuper = true)
public final class ActionStep extends AbstractActionStep {
@JsonPropertyDescription("Optional: Execute one or more REST requests.")
@JsonPropertyDescription("Optional list: Execute one or more REST requests.")
@JsonProperty(required = false) private List<ActionStepRequest> requests;

@JsonPropertyDescription("Optional: Execute one or more fcli commands. For now, only fcli commands that support the standard output options (--output/--store/--to-file) may be used, allowing the JSON output of those commands to be used in subsequent or nested steps. Any console output is suppressed, and any non-zero exit codes will produce an error.")
@JsonPropertyDescription("Optional list: Execute one or more fcli commands. For now, only fcli commands that support the standard output options (--output/--store/--to-file) may be used, allowing the JSON output of those commands to be used in subsequent or nested steps. Any console output is suppressed, and any non-zero exit codes will produce an error.")
@JsonProperty(required = false) private List<ActionStepFcli> fcli;

@JsonPropertyDescription("Optional: Write a progress message.")
@JsonPropertyDescription("Optional SpEL template expression: Write a progress message.")
@JsonProperty(required = false) private TemplateExpression progress;

@JsonPropertyDescription("Optional: Write a warning message to console and log file (if enabled). Note that warning messages will be shown on console only after all action steps have been executed, to not interfere with progress messages.")
@JsonPropertyDescription("Optional SpEL template expression: Write a warning message to console and log file (if enabled). Note that warning messages will be shown on console only after all action steps have been executed, to not interfere with progress messages.")
@JsonProperty(required = false) private TemplateExpression warn;

@JsonPropertyDescription("Optional: Write a debug message to log file (if enabled).")
@JsonPropertyDescription("Optional SpEL template expression: Write a debug message to log file (if enabled).")
@JsonProperty(required = false) private TemplateExpression debug;

@JsonPropertyDescription("Optional: Throw an exception, thereby terminating action execution.")
@JsonPropertyDescription("Optional SpEL template expression: Throw an exception, thereby terminating action execution.")
@JsonProperty(value = "throw", required = false) private TemplateExpression _throw;

@JsonPropertyDescription("Optional: Terminate action execution and return the given exit code.")
@JsonPropertyDescription("OptionalSpEL template expression: Terminate action execution and return the given exit code.")
@JsonProperty(value = "exit", required = false) private TemplateExpression _exit;

@JsonPropertyDescription("Optional: Set a data value for use in subsequent steps.")
@JsonPropertyDescription("Optional list: Set a data value for use in subsequent steps.")
@JsonProperty(required = false) private List<ActionStepSet> set;

@JsonPropertyDescription("Optional: Append a data value for use in subsequent steps.")
@JsonPropertyDescription("Optional list: Append a data value for use in subsequent steps.")
@JsonProperty(required = false) private List<ActionStepAppend> append;

@JsonPropertyDescription("Optional: Unset a data value for use in subsequent steps.")
@JsonPropertyDescription("Optional list: Unset a data value for use in subsequent steps.")
@JsonProperty(required = false) private List<ActionStepUnset> unset;

@JsonPropertyDescription("Optional: Write data to a file, stdout, or stderr. Note that output to stdout and stderr will be deferred until action termination as to not interfere with progress messages.")
@JsonPropertyDescription("Optional list: Write data to a file, stdout, or stderr. Note that output to stdout and stderr will be deferred until action termination as to not interfere with progress messages.")
@JsonProperty(required = false) private List<ActionStepWrite> write;

@JsonPropertyDescription("Optional: Iterate over a given array of values.")
@JsonPropertyDescription("Optional object: Iterate over a given array of values.")
@JsonProperty(required = false) private ActionStepForEach forEach;

@JsonPropertyDescription("Optional: Mostly used for security policy and similar actions to define PASS/FAIL criteria. Upon action termination, check results will be written to console and return a non-zero exit code if the outcome of on or more checks was FAIL.")
@JsonPropertyDescription("Optional list: Mostly used for security policy and similar actions to define PASS/FAIL criteria. Upon action termination, check results will be written to console and return a non-zero exit code if the outcome of on or more checks was FAIL.")
@JsonProperty(required = false) private List<ActionStepCheck> check;

@JsonPropertyDescription("Optional: Sub-steps to be executed; useful for grouping or conditional execution of multiple steps.")
@JsonPropertyDescription("Optional list: Sub-steps to be executed; useful for grouping or conditional execution of multiple steps.")
@JsonProperty(required = false) private List<ActionStep> steps;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@
@Reflectable @NoArgsConstructor
@Data @EqualsAndHashCode(callSuper = true)
public final class ActionStepAppend extends AbstractActionStepUpdateProperty {
@JsonPropertyDescription("Optional: Property name to be added or updated in the data object specified by 'name'. If specified, 'name' is considered to be an object, otherwise 'name' is considered to be an array.")
@JsonPropertyDescription("Optional SpEL template expression: Property name to be added or updated in the data object specified by 'name'. If specified, 'name' is considered to be an object, otherwise 'name' is considered to be an array.")
@JsonProperty(required = false) private TemplateExpression property;
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,16 @@
@Reflectable @NoArgsConstructor
@Data @EqualsAndHashCode(callSuper = true)
public final class ActionStepCheck extends AbstractActionStep {
@JsonPropertyDescription("Required: Display name of this check, to be displayed in PASS/FAIL messages.")
@JsonPropertyDescription("Required string: Display name of this check, to be displayed in PASS/FAIL messages.")
@JsonProperty(required = true) private String displayName;

@JsonPropertyDescription("Required if 'passIf' not specified: The outcome of this check will be 'FAIL' if the given expression evaluates to 'true', outcome will be 'PASS' otherwise.")
@JsonPropertyDescription("Required SpEL template expression if 'passIf' not specified: The outcome of this check will be 'FAIL' if the given expression evaluates to 'true', outcome will be 'PASS' otherwise.")
@JsonProperty(required = false) private TemplateExpression failIf;

@JsonPropertyDescription("Required if 'failIf' not specified: The outcome of this check will be 'SUCCESS' if the given expression evaluates to 'true', outcome will be 'FAIL' otherwise.")
@JsonPropertyDescription("Required SpEL template expression if 'failIf' not specified: The outcome of this check will be 'SUCCESS' if the given expression evaluates to 'true', outcome will be 'FAIL' otherwise.")
@JsonProperty(required = false) private TemplateExpression passIf;

@JsonPropertyDescription("Optional: Define the check result in case the check is being skipped due to conditional execution or no records to be processed in forEach blocks.")
@JsonPropertyDescription("Optional enum value: Define the check result in case the check is being skipped due to conditional execution or no records to be processed in forEach blocks.")
@JsonProperty(required = false, defaultValue = "SKIP") private CheckStatus ifSkipped = CheckStatus.SKIP;

public final void postLoad(Action action) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@
@Reflectable @NoArgsConstructor
@Data @EqualsAndHashCode(callSuper = true)
public final class ActionStepFcli extends AbstractActionStep {
@JsonPropertyDescription("Required: Arguments to pass to the fcli command, for example 'ssc appversion list --embed=attrValuesByName'.")
@JsonPropertyDescription("Required SpEL template expression: Arguments to pass to the fcli command, for example 'ssc appversion list --embed=attrValuesByName'.")
@JsonProperty(required = true) private TemplateExpression args;

@JsonPropertyDescription("Optional: Name to assign to the outcome of this fcli invocation. Can be referenced in subsequent steps using ${name}.")
@JsonPropertyDescription("Optional string: Name to assign to the outcome of this fcli invocation. Can be referenced in subsequent steps using ${name}.")
@JsonProperty(required = false) private String name;

@JsonPropertyDescription("Optional: Steps to be executed for each individual record generated by the given fcli invocation.")
@JsonPropertyDescription("Optional object: Steps to be executed for each individual record generated by the given fcli invocation.")
@JsonProperty(value = "forEach", required = false) private ActionStepFcli.ActionStepFcliForEachDescriptor forEach;

/**
Expand Down
Loading

0 comments on commit a25f68a

Please sign in to comment.