diff --git a/schema/README.md b/schema/README.md new file mode 100644 index 0000000..7cc4d93 --- /dev/null +++ b/schema/README.md @@ -0,0 +1,6 @@ +# SARIF schema files + + +`Sarif-1.0.0.schema.json` comes from the [SARIF repo](https://github.com/microsoft/sarif-sdk/) under MIT license. + +Converted into Scala using [jsonschema2pojo](https://github.com/joelittlejohn/jsonschema2pojo), commited under `./scala-gen`. diff --git a/schema/Sarif-1.0.0.schema.json b/schema/Sarif-1.0.0.schema.json new file mode 100644 index 0000000..456a372 --- /dev/null +++ b/schema/Sarif-1.0.0.schema.json @@ -0,0 +1,1250 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "Static Analysis Results Format (SARIF) Version 1.0.0 JSON Schema", + "description": "Static Analysis Results Format (SARIF) Version 1.0.0 JSON Schema: a standard format for the output of static analysis and other tools.", + "additionalProperties": false, + "type": "object", + "properties": { + + "$schema": { + "description": "The URI of the JSON schema corresponding to the version.", + "type": "string", + "format": "uri" + }, + + "version": { + "description": "The SARIF format version of this log file.", + "enum": [ "1.0.0" ] + }, + + "runs": { + "description": "The set of runs contained in this log file.", + "type": "array", + "minItems": 1, + "items": { + "$ref": "#/definitions/run" + } + } + }, + "required": [ "version", "runs" ], + "definitions": { + + "annotatedCodeLocation": { + "description": "An annotation used to express code flows through a method or other locations that are related to a result.", + "additionalProperties": false, + "type": "object", + "properties": { + + "id": { + "description": "OBSOLETE (use \"step\" instead): An identifier for the location, unique within the scope of the code flow within which it occurs.", + "type": [ "integer", "string" ], + "pattern": "^[1-9][0-9]*$", + "minimum": 1 + }, + + "step": { + "description": "The 0-based sequence number of the location in the code flow within which it occurs.", + "type": "integer", + "minimum": 0 + }, + + "physicalLocation": { + "description": "A file location to which this annotation refers.", + "$ref": "#/definitions/physicalLocation" + }, + + "fullyQualifiedLogicalName": { + "description": "The fully qualified name of the method or function that is executing.", + "type": "string" + }, + + "logicalLocationKey": { + "description": "A key used to retrieve the annotation's logicalLocation from the logicalLocations dictionary.", + "type": "string" + }, + + "module": { + "description": "The name of the module that contains the code that is executing.", + "type": "string" + }, + + "threadId": { + "description": "The thread identifier of the code that is executing.", + "type": "integer" + }, + + "message": { + "description": "A message relevant to this annotation.", + "type": "string" + }, + + "kind": { + "description": "Categorizes the location.", + "enum": [ "alias", "assignment", "branch", "call", "callReturn", "continuation", "declaration", "functionEnter", "functionExit", "functionReturn", "usage" ] + }, + + "taintKind": { + "description": "Classifies state transitions in code locations relevant to a taint analysis.", + "enum": [ "source", "sink", "sanitizer" ] + }, + + "target": { + "description": "The fully qualified name of the target on which this location operates. For an annotation of kind 'call', for example, the target refers to the fully qualified logical name of the function called from this location.", + "type": "string" + }, + + "values": { + "description": "An ordered set of strings that comprise input or return values for the current operation. For an annotation of kind 'call', for example, this property may hold the ordered list of arguments passed to the callee.", + "type": "array", + "default": [ ], + "items": { + "type": "string" + } + }, + + "state": { + "description": "A dictionary, each of whose keys specifies a variable or expression, the associated value of which represents the variable or expression value. For an annotation of kind 'continuation', for example, this dictionary might hold the current assumed values of a set of global variables.", + "type": "object" + }, + + "targetKey": { + "description": "A key used to retrieve the target's logicalLocation from the logicalLocations dictionary.", + "type": "string" + }, + + "essential": { + "description": "OBSOLETE (use \"importance\" instead): True if this location is essential to understanding the code flow in which it occurs.", + "type": "boolean" + }, + + "importance": { + "description": "Specifies the importance of this location in understanding the code flow in which it occurs. The order from most to least important is \"essential\", \"important\", \"unimportant\". Default: \"important\".", + "enum": [ "important", "essential", "unimportant" ] + }, + + "snippet": { + "description": "The source code at the specified location.", + "type": "string" + }, + + "annotations": { + "description": "A set of messages relevant to the current annotated code location.", + "type": "array", + "minItems": 1, + "uniqueItems": true, + "items": { + "$ref": "#/definitions/annotation" + } + }, + + "properties": { + "description": "Key/value pairs that provide additional information about the code location.", + "type": "object", + "additionalProperties": true, + "properties": { + + "tags": { + "description": "A set of distinct strings that provide additional information.", + "type": "array", + "uniqueItems": true, + "default": [ ], + "items": { + "type": "string" + } + } + } + } + } + }, + + "annotation": { + "type": "object", + "properties": { + + "message": { + "description": "A message relevant to a code location", + "type": "string" + }, + + "locations": { + "description": "An array of 'physicalLocation' objects associated with the annotation.", + "type": "array", + "minItems": 1, + "items": { + "$ref": "#/definitions/physicalLocation" + } + } + }, + "required": [ "message", "locations" ] + }, + + "codeFlow": { + "type": "object", + "properties": { + + "message": { + "description": "A message relevant to the code flow", + "type": "string" + }, + + "locations": { + "description": "An array of 'annotatedCodeLocation' objects, each of which describes a single location visited by the tool in the course of producing the result.", + "type": "array", + "minItems": 1, + "items": { + "$ref": "#/definitions/annotatedCodeLocation" + } + }, + + "properties": { + "description": "Key/value pairs that provide additional information about the code flow.", + "type": "object", + "additionalProperties": true, + "properties": { + + "tags": { + "description": "A set of distinct strings that provide additional information.", + "type": "array", + "uniqueItems": true, + "default": [ ], + "items": { + "type": "string" + } + } + } + } + }, + "required": [ "locations" ] + }, + "exception": { + "type": "object", + "properties": { + + "kind": { + "type": "string", + "description": "A string that identifies the kind of exception, for example, the fully qualified type name of an object that was thrown, or the symbolic name of a signal." + }, + + "message": { + "type": "string", + "description": "A string that describes the exception." + }, + + "stack": { + "description": "The sequence of function calls leading to the exception.", + "$ref": "#/definitions/stack" + }, + + "innerExceptions": { + "type": "array", + "description": "An array of exception objects each of which is considered a cause of this exception.", + "items": { + "$ref": "#/definitions/exception" + } + } + } + }, + "fileChange": { + "description": "A change to a single file.", + "additionalProperties": false, + "type": "object", + "properties": { + + "uri": { + "description": "A string that represents the location of the file to change as a valid URI.", + "type": "string", + "format": "uri" + }, + + "uriBaseId": { + "description": "A string that identifies the conceptual base for the 'uri' property (if it is relative), e.g.,'$(SolutionDir)' or '%SRCROOT%'.", + "type": "string" + }, + + "replacements": { + "description": "An array of replacement objects, each of which represents the replacement of a single range of bytes in a single file specified by 'uri'.", + "type": "array", + "minItems": 1, + "items": { + "$ref": "#/definitions/replacement" + } + } + }, + + "required": [ "uri", "replacements" ], + "dependencies": { + "uriBaseId": [ "uri" ] + } + }, + "file": { + "description": "A single file. In some cases, this file might be nested within another file.", + "additionalProperties": false, + "type": "object", + "properties": { + + "uri": { + "description": "The path to the file within its containing file.", + "type": "string", + "format": "uri" + }, + + "uriBaseId": { + "description": "A string that identifies the conceptual base for the 'uri' property (if it is relative), e.g.,'$(SolutionDir)' or '%SRCROOT%'.", + "type": "string" + }, + + "parentKey": { + "description": "Identifies the key of the immediate parent of the file, if this file is nested.", + "type": "string" + }, + + "offset": { + "description": "The offset in bytes of the file within its containing file.", + "type": "integer" + }, + + "length": { + "description": "The length of the file in bytes.", + "type": "integer" + }, + + "mimeType": { + "description": "The MIME type (RFC 2045) of the file.", + "type": "string", + "pattern": "[^/]+/.+" + }, + + "contents": { + "description": "The contents of the file, expressed as a MIME Base64-encoded byte sequence.", + "type": "string" + }, + + "hashes": { + "description": "An array of hash objects, each of which specifies a hashed value for the file, along with the name of the algorithm used to compute the hash.", + "type": "array", + "minItems": 1, + "uniqueItems": true, + "items": { + "$ref": "#/definitions/hash" + } + }, + + "properties": { + "description": "Key/value pairs that provide additional information about the file.", + "type": "object", + "additionalProperties": true, + "properties": { + + "tags": { + "description": "A set of distinct strings that provide additional information.", + "type": "array", + "uniqueItems": true, + "default": [ ], + "items": { + "type": "string" + } + } + } + } + }, + + "dependencies": { + "uriBaseId": [ "uri" ] + } + }, + "fix": { + "description": "A proposed fix for the problem represented by a result object. A fix specifies a set of file to modify. For each file, it specifies a set of bytes to remove, and provides a set of new bytes to replace them.", + "additionalProperties": false, + "type": "object", + "properties": { + + "description": { + "description": "A string that describes the proposed fix, enabling viewers to present a proposed change to an end user.", + "type": "string" + }, + + "fileChanges": { + "description": "One or more file changes that comprise a fix for a result.", + "type": "array", + "items": { + "$ref": "#/definitions/fileChange" + } + } + }, + "required": [ "fileChanges" ] + }, + "formattedRuleMessage": { + "description": "Contains information that can be used to construct a formatted message that describes a result.", + "additionalProperties": false, + "type": "object", + "properties": { + + "formatId": { + "description": "A string that identifies the message format used to format the message that describes this result. The value of formatId must correspond to one of the names in the set of name/value pairs contained in the 'messageFormats' property of the rule object whose 'id' property matches the 'ruleId' property of this result.", + "type": "string" + }, + + "arguments": { + "description": "An array of strings that will be used, in combination with a message format, to construct a result message.", + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ "formatId" ] + }, + "hash": { + "description": "A hash value of some file or collection of files, together with the algorithm used to compute the hash.", + "additionalProperties": false, + "type": "object", + "properties": { + + "value": { + "description": "The hash value of some file or collection of files, computed by the algorithm named in the 'algorithm' property.", + "type": "string" + }, + + "algorithm": { + "description": "The name of the algorithm used to compute the hash value specified in the 'value' property.", + "enum": [ "authentihash", "blake256", "blake512", "ecoh", "fsb", "gost", "groestl", "has160", "haval", "jh", "md2", "md4", "md5", "md6", "radioGatun", "ripeMD", "ripeMD128", "ripeMD160", "ripeMD320", "sdhash", "sha1", "sha224", "sha256", "sha384", "sha512", "sha3", "skein", "snefru", "spectralHash", "ssdeep", "swifft", "tiger", "tlsh", "whirlpool" ] + } + }, + "required": [ "value", "algorithm" ] + }, + "invocation": { + "description": "The runtime environment of the analysis tool run.", + "additionalProperties": false, + "type": "object", + "properties": { + + "commandLine": { + "description": "The command line used to invoke the tool.", + "type": "string" + }, + + "responseFiles": { + "description": "The contents of any response files specified on the tool's command line.", + "type": "object", + "additionalProperties": true + }, + + "startTime": { + "description": "The date and time at which the run started. See \"Date/time properties\" in the SARIF spec for the required format.", + "type": "string", + "format": "date-time" + }, + + "endTime": { + "description": "The date and time at which the run ended. See \"Date/time properties\" in the SARIF spec for the required format.", + "type": "string", + "format": "date-time" + }, + + "machine": { + "description": "The machine that hosted the analysis tool run.", + "type": "string" + }, + + "account": { + "description": "The account that ran the analysis tool.", + "type": "string" + }, + + "processId": { + "description": "The process id for the analysis tool run.", + "type": "integer" + }, + + "fileName": { + "description": "The fully qualified path to the analysis tool.", + "type": "string" + }, + + "workingDirectory": { + "description": "The working directory for the analysis rool run.", + "type": "string" + }, + + "environmentVariables": { + "description": "The environment variables associated with the analysis tool process, expressed as key/value pairs.", + "type": "object", + "additionalProperties": true, + "default": { } + }, + + "properties": { + "description": "Key/value pairs that provide additional information about the run.", + "type": "object", + "additionalProperties": true, + "properties": { + "tags": { + + "description": "A set of distinct strings that provide additional information.", + "type": "array", + "uniqueItems": true, + "default": [ ], + "items": { + "type": "string" + } + } + } + } + } + }, + "location": { + "description": "The location where an analysis tool produced a result.", + "additionalProperties": false, + "type": "object", + "properties": { + + "analysisTarget": { + "description": "Identifies the file that the analysis tool was instructed to scan. This need not be the same as the file where the result actually occurred.", + "$ref": "#/definitions/physicalLocation" + }, + + "resultFile": { + "description": "Identifies the file where the analysis tool produced the result.", + "$ref": "#/definitions/physicalLocation" + }, + + "fullyQualifiedLogicalName": { + "description": "The human-readable fully qualified name of the logical location where the analysis tool produced the result. If 'logicalLocationKey' is not specified, this member is can used to retrieve the location logicalLocation from the logicalLocations dictionary, if one exists.", + "type": "string" + }, + + "logicalLocationKey": { + "description": "A key used to retrieve the location logicalLocation from the logicalLocations dictionary, when the string specified by 'fullyQualifiedLogicalName' is not unique.", + "type": "string" + }, + + "decoratedName": { + "description": "The machine-readable fully qualified name for the logical location where the analysis tool produced the result, such as the mangled function name provided by a C++ compiler that encodes calling convention, return type and other details along with the function name.", + "type": "string" + }, + + "properties": { + "description": "Key/value pairs that provide additional information about the location.", + "type": "object", + "additionalProperties": true, + "properties": { + "tags": { + + "description": "A set of distinct strings that provide additional information.", + "type": "array", + "uniqueItems": true, + "default": [ ], + "items": { + "type": "string" + } + } + } + } + } + }, + "logicalLocation": { + "description": "A logical location of a construct that produced a result.", + "additionalProperties": false, + "type": "object", + "properties": { + + "name": { + "description": "Identifies the construct in which the result occurred. For example, this property might contain the name of a class or a method.", + "type": "string" + }, + + "parentKey": { + "description": "Identifies the key of the immediate parent of the construct in which the result was detected. For example, this property might point to a logical location that represents the namespace that holds a type.", + "type": "string" + }, + + "kind": { + "description": "The type of construct this logicalLocationComponent refers to. Should be one of 'function', 'member', 'module', 'namespace', 'package', 'resource', or 'type', if any of those accurately describe the construct.", + "type": "string" + } + } + }, + "notification": { + "type": "object", + "description": "Describes a condition relevant to the tool itself, as opposed to being relevant to a target being analyzed by the tool.", + "additionalProperties": false, + "properties": { + + "id": { + "description": "An identifier for the condition that was encountered.", + "type": "string" + }, + + "ruleId": { + "description": "The stable, unique identifier of the rule (if any) to which this notification is relevant. If 'ruleKey' is not specified, this member can be used to retrieve rule metadata from the rules dictionary, if it exists.", + "type": "string" + }, + + "ruleKey": { + "description": "A key used to retrieve the rule metadata from the rules dictionary that is relevant to the notificationn.", + "type": "string" + }, + + "physicalLocation": { + "description": "The file and region relevant to this notification.", + "$ref": "#/definitions/physicalLocation" + }, + + "message": { + "description": "A string that describes the condition that was encountered.", + "type": "string" + }, + + "level": { + "description": "A value specifying the severity level of the notification.", + "default": "warning", + "enum": [ "note", "warning", "error" ] + }, + + "threadId": { + "description": "The thread identifier of the code that generated the notification.", + "type": "integer" + }, + + "time": { + "description": "The date and time at which the analysis tool generated the notification.", + "type": "string", + "format": "date-time" + }, + + "exception": { + "description": "The runtime exception, if any, relevant to this notification.", + "$ref": "#/definitions/exception" + }, + + "properties": { + "description": "Key/value pairs that provide additional information about the notification.", + "type": "object", + "additionalProperties": true, + "properties": { + + "tags": { + "description": "A set of distinct strings that provide additional information.", + "type": "array", + "uniqueItems": true, + "default": [ ], + "items": { + "type": "string" + } + } + } + } + }, + "required": [ "message" ] + }, + "physicalLocation": { + "description": "A physical location relevant to a result. Specifies a reference to a programming artifact together with a range of bytes or characters within that artifact.", + "additionalProperties": false, + "type": "object", + "properties": { + + "uri": { + "description": "The location of the file as a valid URI.", + "type": "string", + "format": "uri" + }, + + "uriBaseId": { + "description": "A string that identifies the conceptual base for the 'uri' property (if it is relative), e.g.,'$(SolutionDir)' or '%SRCROOT%'.", + "type": "string" + }, + + "region": { + "description": "The region within the file where the result was detected.", + "$ref": "#/definitions/region" + } + }, + + "dependencies": { + "uriBaseId": [ "uri" ] + } + }, + "region": { + "description": "A region within a file where a result was detected.", + "additionalProperties": false, + "type": "object", + "properties": { + + "startLine": { + "description": "The line number of the first character in the region.", + "type": "integer", + "minimum": 1 + }, + + "startColumn": { + "description": "The column number of the first character in the region.", + "type": "integer", + "minimum": 1 + }, + + "endLine": { + "description": "The line number of the last character in the region.", + "type": "integer", + "minimum": 1 + }, + + "endColumn": { + "description": "The column number of the last character in the region.", + "type": "integer", + "minimum": 1 + }, + + "offset": { + "description": "The zero-based offset from the beginning of the file of the first byte or character in the region.", + "type": "integer", + "minimum": 0 + }, + + "length": { + "description": "The length of the region in bytes or characters.", + "type": "integer", + "minimum": 0 + } + } + }, + "replacement": { + "description": "The replacement of a single range of bytes in a file. Specifies the location within the file where the replacement is to be made, the number of bytes to remove at that location, and a sequence of bytes to insert at that location.", + "additionalProperties": false, + "type": "object", + "properties": { + + "offset": { + "description": "A non-negative integer specifying the offset in bytes from the beginning of the file at which bytes are to be removed, inserted or both. An offset of 0 shall denote the first byte in the file.", + "type": "integer", + "minimum": 0 + }, + + "deletedLength": { + "description": "The number of bytes to delete, starting at the byte offset specified by offset, measured from the beginning of the file.", + "type": "integer", + "minimum": 1 + }, + + "insertedBytes": { + "description": "The MIME Base64-encoded byte sequence to be inserted at the byte offset specified by the 'offset' property, measured from the beginning of the file.", + "type": "string" + } + }, + "required": [ "offset" ] + }, + "result": { + "description": "A result produced by an analysis tool.", + "additionalProperties": false, + "type": "object", + "properties": { + + "ruleId": { + "description": "The stable, unique identifier of the rule (if any) to which this notification is relevant. If 'ruleKey' is not specified, this member can be used to retrieve rule metadata from the rules dictionary, if it exists.", + "type": "string" + }, + + "ruleKey": { + "description": "A key used to retrieve the rule metadata from the rules dictionary that is relevant to the notificationn.", + "type": "string" + }, + + "level": { + "description": "A value specifying the severity level of the result. If this property is not present, its implied value is 'warning'.", + "default": "warning", + "enum": [ "notApplicable", "pass", "note", "warning", "error" ] + }, + + "message": { + "description": "A string that describes the result. The first sentence of the message only will be displayed when visible space is limited.", + "type": "string" + }, + + "formattedRuleMessage": { + "description": "A 'formattedRuleMessage' object that can be used to construct a formatted message that describes the result. If the 'formattedMessage' property is present on a result, the 'fullMessage' property shall not be present. If the 'fullMessage' property is present on an result, the 'formattedMessage' property shall not be present", + "$ref": "#/definitions/formattedRuleMessage" + }, + + "locations": { + "description": "One or more locations where the result occurred. Specify only one location unless the problem indicated by the result can only be corrected by making a change at every specified location.", + "type": "array", + "minItems": 1, + "uniqueItems": true, + "items": { + "$ref": "#/definitions/location" + } + }, + + "snippet": { + "description": "A source code or other file fragment that illustrates the result.", + "type": "string" + }, + + "id": { + "description": "A unique identifer for the result.", + "type": "string" + }, + + "toolFingerprintContribution": { + "description": "A string that contributes to the unique identity of the result.", + "type": "string" + }, + + "stacks": { + "description": "An array of 'stack' objects relevant to the result.", + "type": "array", + "minItems": 1, + "uniqueItems": true, + "items": { + "$ref": "#/definitions/stack" + } + }, + + "codeFlows": { + "description": "An array of 'codeFlow' objects relevant to the result.", + "type": "array", + "minItems": 1, + "uniqueItems": true, + "items": { + "$ref": "#/definitions/codeFlow" + } + }, + + "relatedLocations": { + "description": "A grouped set of locations and messages, if available, that represent code areas that are related to this result.", + "type": "array", + "minItems": 1, + "uniqueItems": true, + "items": { + "$ref": "#/definitions/annotatedCodeLocation" + } + }, + + "suppressionStates": { + "type": "array", + "items": { + "description": "A flag value indicating one or more suppression conditions.", + "enum": [ + "suppressedInSource", "suppressedExternally" + ] + } + }, + + "baselineState": { + "description": "The state of a result relative to a baseline of a previous run.", + "enum": [ + "new", + "existing", + "absent" + ] + }, + + "fixes": { + "description": "An array of 'fix' objects, each of which represents a proposed fix to the problem indicated by the result.", + "type": "array", + "minItems": 1, + "uniqueItems": true, + "items": { + "$ref": "#/definitions/fix" + } + }, + + "properties": { + "description": "Key/value pairs that provide additional information about the result.", + "type": "object", + "additionalProperties": true, + "properties": { + + "tags": { + "description": "A set of distinct strings that provide additional information.", + "type": "array", + "uniqueItems": true, + "default": [ ], + "items": { + "type": "string" + } + } + } + } + } + }, + "rule": { + "description": "Describes an analysis rule.", + "additionalProperties": false, + "type": "object", + "properties": { + + "id": { + "description": "A stable, opaque identifier for the rule.", + "type": "string" + }, + + "name": { + "description": "A rule identifier that is understandable to an end user.", + "type": "string" + }, + + "shortDescription": { + "description": "A concise description of the rule. Should be a single sentence that is understandable when visible space is limited to a single line of text.", + "type": "string" + }, + + "fullDescription": { + "description": "A string that describes the rule. Should, as far as possible, provide details sufficient to enable resolution of any problem indicated by the result.", + "type": "string" + }, + + "messageFormats": { + "description": "A set of name/value pairs with arbitrary names. The value within each name/value pair shall consist of plain text interspersed with placeholders, which can be used to format a message in combination with an arbitrary number of additional string arguments.", + "type": "object" + }, + + "configuration": { + "description": "A value specifying whether a rule is enabled.", + "default": "unknown", + "enum": [ "unknown", "enabled", "disabled" ] + }, + + "defaultLevel": { + "description": "A value specifying the default severity level of the result.", + "default": "warning", + "enum": [ "note", "warning", "error" ] + }, + + "helpUri": { + "description": "A URI where the primary documentation for the rule can be found.", + "type": "string", + "format": "uri" + }, + + "properties": { + "description": "Key/value pairs that provide additional information about the rule.", + "type": "object", + "additionalProperties": true, + "properties": { + "tags": { + + "description": "A set of distinct strings that provide additional information.", + "type": "array", + "uniqueItems": true, + "default": [ ], + "items": { + "type": "string" + } + } + } + } + }, + "required": [ "id" ] + }, + "run": { + "description": "Describes a single run of an analysis tool, and contains the output of that run.", + "additionalProperties": false, + "type": "object", + "properties": { + + "tool": { + "description": "Information about the tool or tool pipeline that generated the results in this run. A run can only contain results produced by a single tool or tool pipeline. A run can aggregate results from multiple log files, as long as context around the tool run (tool command-line arguments and the like) is identical for all aggregated files.", + "$ref": "#/definitions/tool" + }, + + "invocation": { + "description": "Describes the runtime environment, including parameterization, of the analysis tool run.", + "$ref": "#/definitions/invocation" + }, + + "files": { + "description": "A dictionary, each of whose keys is a URI and each of whose values is an array of file objects representing the location of a single file scanned during the run.", + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/file" + } + }, + + "logicalLocations": { + "description": "A dictionary, each of whose keys specifies a logical location such as a namespace, type or function.", + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/logicalLocation" + } + }, + + "results": { + "description": "The set of results contained in an SARIF log. The results array can be omitted when a run is solely exporting rules metadata. It must be present (but may be empty) in the event that a log file represents an actual scan.", + "type": "array", + "minItems": 0, + "uniqueItems": true, + "items": { + "$ref": "#/definitions/result" + } + }, + + "toolNotifications": { + "description": "A list of runtime conditions detected by the tool in the course of the analysis.", + "type": "array", + "items": { + "$ref": "#/definitions/notification" + } + }, + + "configurationNotifications": { + "description": "A list of conditions detected by the tool that are relevant to the tool's configuration.", + "type": "array", + "items": { + "$ref": "#/definitions/notification" + } + }, + + "rules": { + "description": "A dictionary, each of whose keys is a string and each of whose values is a 'rule' object, that describe all rules associated with an analysis tool or a specific run of an analysis tool.", + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/rule" + } + }, + + "id": { + "description": "An identifier for the run.", + "type": "string" + }, + + "stableId": { + "description": "A stable identifier for a run, for example, 'nightly Clang analyzer run'. Multiple runs of the same type can have the same stableId.", + "type": "string" + }, + + "automationId": { + "description": "A global identifier that allows the run to be correlated with other artifacts produced by a larger automation process.", + "type": "string" + }, + + "baselineId": { + "description": "The 'id' property of a separate (potentially external) SARIF 'run' instance that comprises the baseline that was used to compute result 'baselineState' properties for the run.", + "type": "string" + }, + + "architecture": { + "description": "The hardware architecture for which the run was targeted.", + "type": "string" + }, + + "properties": { + "description": "Key/value pairs that provide additional information about the run.", + "type": "object", + "additionalProperties": true, + "properties": { + + "tags": { + "description": "A set of distinct strings that provide additional information about the run.", + "type": "array", + "uniqueItems": true, + "default": [ ], + "items": { + "type": "string" + } + } + } + } + }, + "required": [ "tool" ] + }, + "stack": { + "description": "A call stack that is relevant to a result.", + "additionalProperties": false, + "type": "object", + "properties": { + + "message": { + "description": "A message relevant to this call stack.", + "type": "string" + }, + + "frames": { + "description": "An array of stack frames that represent a sequence of calls, rendered in reverse chronological order, that comprise the call stack.", + "type": "array", + "minItems": 1, + "items": { + "$ref": "#/definitions/stackFrame" + } + }, + + "properties": { + "description": "Key/value pairs that provide additional information about the stack.", + "type": "object", + "additionalProperties": true, + "properties": { + + "tags": { + "description": "A set of distinct strings that provide additional information.", + "type": "array", + "uniqueItems": true, + "default": [ ], + "items": { + "type": "string" + } + } + } + } + }, + "required": [ "frames" ] + }, + "stackFrame": { + "description": "A function call within a stack trace.", + "additionalProperties": false, + "type": "object", + "properties": { + + "message": { + "description": "A message relevant to this stack frame.", + "type": "string" + }, + + "uri": { + "description": "The uri of the source code file to which this stack frame refers.", + "type": "string", + "format": "uri" + }, + + "uriBaseId": { + "description": "A string that identifies the conceptual base for the 'uri' property (if it is relative), e.g.,'$(SolutionDir)' or '%SRCROOT%'.", + "type": "string" + }, + + "line": { + "description": "The line of the location to which this stack frame refers.", + "type": "integer" + }, + + "column": { + "description": "The line of the location to which this stack frame refers.", + "type": "integer" + }, + + "module": { + "description": "The name of the module that contains the code of this stack frame.", + "type": "string" + }, + + "threadId": { + "description": "The thread identifier of the stack frame.", + "type": "integer" + }, + + "fullyQualifiedLogicalName": { + "description": "The fully qualified name of the method or function that is executing.", + "type": "string" + }, + + "logicalLocationKey": { + "description": "A key used to retrieve the stack frame logicalLocation from the logicalLocations dictionary, when the 'fullyQualifiedLogicalName' is not unique.", + "type": "string" + }, + + "address": { + "description": "The address of the method or function that is executing.", + "type": "integer" + }, + + "offset": { + "description": "The offset from the method or function that is executing.", + "type": "integer" + }, + + "parameters": { + "description": "The parameters of the call that is executing.", + "type": "array", + "items": { + "type": "string", + "default": [ ] + } + }, + + "properties": { + "description": "Key/value pairs that provide additional information about the stack frame.", + "type": "object", + "additionalProperties": true, + "properties": { + "tags": { + + "description": "A set of distinct strings that provide additional information.", + "type": "array", + "uniqueItems": true, + "default": [ ], + "items": { + "type": "string" + } + } + } + } + }, + + "required": [ "fullyQualifiedLogicalName" ], + "dependencies": { + "uriBaseId": [ "uri" ], + "line": [ "uri" ], + "column": [ "line" ] + } + }, + "tool": { + "description": "The analysis tool that was run.", + "additionalProperties": false, + "type": "object", + "properties": { + + "name": { + "description": "The name of the tool.", + "type": "string" + }, + + "fullName": { + "description": "The name of the tool along with its version and any other useful identifying information, such as its locale.", + "type": "string" + }, + + "version": { + "description": "The tool version, in whatever format the tool natively provides.", + "type": "string" + }, + + "semanticVersion": { + "description": "The tool version in the format specified by Semantic Versioning 2.0.", + "type": "string" + }, + + "fileVersion": { + "description": "The binary version of the tool's primary executable file (for operating systems such as Windows that provide that information).", + "type": "string", + "pattern": "[0-9]+(\\.[0-9]+){3}" + }, + + "sarifLoggerVersion": { + "description": "A version that uniquely identifies the SARIF logging component that generated this file, if it is versioned separately from the tool.", + "type": "string" + }, + + "language": { + "description": "The tool language (expressed as an ISO 649 two-letter lowercase culture code) and region (expressed as an ISO 3166 two-letter uppercase subculture code associated with a country or region).", + "type": "string" + }, + + "properties": { + "description": "Key/value pairs that provide additional information about the tool.", + "type": "object", + "additionalProperties": true, + "properties": { + + "tags": { + "description": "A set of distinct strings that provide additional information.", + "type": "array", + "uniqueItems": true, + "default": [ ], + "items": { + "type": "string" + } + } + } + } + }, + "required": [ "name" ] + } + } +} \ No newline at end of file diff --git a/schema/scala-gen/AnnotatedCodeLocation.scala b/schema/scala-gen/AnnotatedCodeLocation.scala new file mode 100644 index 0000000..9799b9b --- /dev/null +++ b/schema/scala-gen/AnnotatedCodeLocation.scala @@ -0,0 +1,355 @@ +import java.util.ArrayList +import java.util.HashMap +import java.util.LinkedHashSet +import java.util.List +import java.util.Map +import java.util.Set +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonInclude +import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.annotation.JsonPropertyDescription +import com.fasterxml.jackson.annotation.JsonPropertyOrder +import com.fasterxml.jackson.annotation.JsonValue +import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import AnnotatedCodeLocation._ +import scala.beans.{BeanProperty, BooleanBeanProperty} +//remove if not needed +import scala.collection.JavaConversions._ + +object AnnotatedCodeLocation { + + object Importance extends Enumeration { + + val IMPORTANT = new Importance("important") + + val ESSENTIAL = new Importance("essential") + + val UNIMPORTANT = new Importance("unimportant") + + class Importance private (var value: String) extends Val { + + override def toString(): String = this.value + } + + private val CONSTANTS = new HashMap[String, AnnotatedCodeLocation.Importance]() + + for (c <- values) { + CONSTANTS.put(c.value, c) + } + + @JsonCreator + def fromValue(value: String): AnnotatedCodeLocation.Importance = { + val constant = CONSTANTS.get(value) + if (constant == null) { + throw new IllegalArgumentException(value) + } else { + constant + } + } + + implicit def convertValue(v: Value): Importance = v.asInstanceOf[Importance] + } + + object Kind extends Enumeration { + + val ALIAS = new Kind("alias") + + val ASSIGNMENT = new Kind("assignment") + + val BRANCH = new Kind("branch") + + val CALL = new Kind("call") + + val CALL_RETURN = new Kind("callReturn") + + val CONTINUATION = new Kind("continuation") + + val DECLARATION = new Kind("declaration") + + val FUNCTION_ENTER = new Kind("functionEnter") + + val FUNCTION_EXIT = new Kind("functionExit") + + val FUNCTION_RETURN = new Kind("functionReturn") + + val USAGE = new Kind("usage") + + class Kind private (var value: String) extends Val { + + override def toString(): String = this.value + } + + private val CONSTANTS = new HashMap[String, AnnotatedCodeLocation.Kind]() + + for (c <- values) { + CONSTANTS.put(c.value, c) + } + + @JsonCreator + def fromValue(value: String): AnnotatedCodeLocation.Kind = { + val constant = CONSTANTS.get(value) + if (constant == null) { + throw new IllegalArgumentException(value) + } else { + constant + } + } + + implicit def convertValue(v: Value): Kind = v.asInstanceOf[Kind] + } + + object TaintKind extends Enumeration { + + val SOURCE = new TaintKind("source") + + val SINK = new TaintKind("sink") + + val SANITIZER = new TaintKind("sanitizer") + + class TaintKind private (var value: String) extends Val { + + override def toString(): String = this.value + } + + private val CONSTANTS = new HashMap[String, AnnotatedCodeLocation.TaintKind]() + + for (c <- values) { + CONSTANTS.put(c.value, c) + } + + @JsonCreator + def fromValue(value: String): AnnotatedCodeLocation.TaintKind = { + val constant = CONSTANTS.get(value) + if (constant == null) { + throw new IllegalArgumentException(value) + } else { + constant + } + } + + implicit def convertValue(v: Value): TaintKind = v.asInstanceOf[TaintKind] + } +} + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder(Array("id", "step", "physicalLocation", "fullyQualifiedLogicalName", "logicalLocationKey", "module", "threadId", "message", "kind", "taintKind", "target", "values", "state", "targetKey", "essential", "importance", "snippet", "annotations", "properties")) +class AnnotatedCodeLocation { + + @JsonProperty("id") + @JsonPropertyDescription("OBSOLETE (use \"step\" instead): An identifier for the location, unique within the scope of the code flow within which it occurs.") + @BeanProperty + var id: java.lang.Integer = _ + + @JsonProperty("step") + @JsonPropertyDescription("The 0-based sequence number of the location in the code flow within which it occurs.") + @BeanProperty + var step: java.lang.Integer = _ + + @JsonProperty("physicalLocation") + @JsonPropertyDescription("A physical location relevant to a result. Specifies a reference to a programming artifact together with a range of bytes or characters within that artifact.") + @BeanProperty + var physicalLocation: PhysicalLocation = _ + + @JsonProperty("fullyQualifiedLogicalName") + @JsonPropertyDescription("The fully qualified name of the method or function that is executing.") + @BeanProperty + var fullyQualifiedLogicalName: String = _ + + @JsonProperty("logicalLocationKey") + @JsonPropertyDescription("A key used to retrieve the annotation's logicalLocation from the logicalLocations dictionary.") + @BeanProperty + var logicalLocationKey: String = _ + + @JsonProperty("module") + @JsonPropertyDescription("The name of the module that contains the code that is executing.") + @BeanProperty + var module: String = _ + + @JsonProperty("threadId") + @JsonPropertyDescription("The thread identifier of the code that is executing.") + @BeanProperty + var threadId: java.lang.Integer = _ + + @JsonProperty("message") + @JsonPropertyDescription("A message relevant to this annotation.") + @BeanProperty + var message: String = _ + + @JsonProperty("kind") + @JsonPropertyDescription("Categorizes the location.") + @BeanProperty + var kind: AnnotatedCodeLocation.Kind = _ + + @JsonProperty("taintKind") + @JsonPropertyDescription("Classifies state transitions in code locations relevant to a taint analysis.") + @BeanProperty + var taintKind: AnnotatedCodeLocation.TaintKind = _ + + @JsonProperty("target") + @JsonPropertyDescription("The fully qualified name of the target on which this location operates. For an annotation of kind 'call', for example, the target refers to the fully qualified logical name of the function called from this location.") + @BeanProperty + var target: String = _ + + @JsonProperty("values") + @JsonPropertyDescription("An ordered set of strings that comprise input or return values for the current operation. For an annotation of kind 'call', for example, this property may hold the ordered list of arguments passed to the callee.") + @BeanProperty + var values: List[String] = new ArrayList[String]() + + @JsonProperty("state") + @JsonPropertyDescription("A dictionary, each of whose keys specifies a variable or expression, the associated value of which represents the variable or expression value. For an annotation of kind 'continuation', for example, this dictionary might hold the current assumed values of a set of global variables.") + @BeanProperty + var state: State = _ + + @JsonProperty("targetKey") + @JsonPropertyDescription("A key used to retrieve the target's logicalLocation from the logicalLocations dictionary.") + @BeanProperty + var targetKey: String = _ + + @JsonProperty("essential") + @JsonPropertyDescription("OBSOLETE (use \"importance\" instead): True if this location is essential to understanding the code flow in which it occurs.") + @BeanProperty + var essential: java.lang.Boolean = _ + + @JsonProperty("importance") + @JsonPropertyDescription("Specifies the importance of this location in understanding the code flow in which it occurs. The order from most to least important is \"essential\", \"important\", \"unimportant\". Default: \"important\".") + @BeanProperty + var importance: AnnotatedCodeLocation.Importance = _ + + @JsonProperty("snippet") + @JsonPropertyDescription("The source code at the specified location.") + @BeanProperty + var snippet: String = _ + + @JsonProperty("annotations") + @JsonDeserialize(as = classOf[java.util.LinkedHashSet]) + @JsonPropertyDescription("A set of messages relevant to the current annotated code location.") + @BeanProperty + var annotations: Set[Annotation] = new LinkedHashSet[Annotation]() + + @JsonProperty("properties") + @JsonPropertyDescription("Key/value pairs that provide additional information about the code location.") + @BeanProperty + var properties: Properties__5 = _ + + override def toString(): String = { + val sb = new StringBuilder() + sb.append(classOf[AnnotatedCodeLocation].getName).append('@').append(java.lang.Integer.toHexString(System.identityHashCode(this))).append('[') + sb.append("id") + sb.append('=') + sb.append((if ((this.id == null)) "" else this.id)) + sb.append(',') + sb.append("step") + sb.append('=') + sb.append((if ((this.step == null)) "" else this.step)) + sb.append(',') + sb.append("physicalLocation") + sb.append('=') + sb.append((if ((this.physicalLocation == null)) "" else this.physicalLocation)) + sb.append(',') + sb.append("fullyQualifiedLogicalName") + sb.append('=') + sb.append((if ((this.fullyQualifiedLogicalName == null)) "" else this.fullyQualifiedLogicalName)) + sb.append(',') + sb.append("logicalLocationKey") + sb.append('=') + sb.append((if ((this.logicalLocationKey == null)) "" else this.logicalLocationKey)) + sb.append(',') + sb.append("module") + sb.append('=') + sb.append((if ((this.module == null)) "" else this.module)) + sb.append(',') + sb.append("threadId") + sb.append('=') + sb.append((if ((this.threadId == null)) "" else this.threadId)) + sb.append(',') + sb.append("message") + sb.append('=') + sb.append((if ((this.message == null)) "" else this.message)) + sb.append(',') + sb.append("kind") + sb.append('=') + sb.append((if ((this.kind == null)) "" else this.kind)) + sb.append(',') + sb.append("taintKind") + sb.append('=') + sb.append((if ((this.taintKind == null)) "" else this.taintKind)) + sb.append(',') + sb.append("target") + sb.append('=') + sb.append((if ((this.target == null)) "" else this.target)) + sb.append(',') + sb.append("values") + sb.append('=') + sb.append((if ((this.values == null)) "" else this.values)) + sb.append(',') + sb.append("state") + sb.append('=') + sb.append((if ((this.state == null)) "" else this.state)) + sb.append(',') + sb.append("targetKey") + sb.append('=') + sb.append((if ((this.targetKey == null)) "" else this.targetKey)) + sb.append(',') + sb.append("essential") + sb.append('=') + sb.append((if ((this.essential == null)) "" else this.essential)) + sb.append(',') + sb.append("importance") + sb.append('=') + sb.append((if ((this.importance == null)) "" else this.importance)) + sb.append(',') + sb.append("snippet") + sb.append('=') + sb.append((if ((this.snippet == null)) "" else this.snippet)) + sb.append(',') + sb.append("annotations") + sb.append('=') + sb.append((if ((this.annotations == null)) "" else this.annotations)) + sb.append(',') + sb.append("properties") + sb.append('=') + sb.append((if ((this.properties == null)) "" else this.properties)) + sb.append(',') + if (sb.charAt((sb.length - 1)) == ',') { + sb.setCharAt((sb.length - 1), ']') + } else { + sb.append(']') + } + sb.toString + } + + override def hashCode(): Int = { + var result = 1 + result = ((result * 31) + (if ((this.snippet == null)) 0 else this.snippet.hashCode)) + result = ((result * 31) + (if ((this.physicalLocation == null)) 0 else this.physicalLocation.hashCode)) + result = ((result * 31) + (if ((this.kind == null)) 0 else this.kind.hashCode)) + result = ((result * 31) + (if ((this.importance == null)) 0 else this.importance.hashCode)) + result = ((result * 31) + (if ((this.module == null)) 0 else this.module.hashCode)) + result = ((result * 31) + (if ((this.values == null)) 0 else this.values.hashCode)) + result = ((result * 31) + (if ((this.taintKind == null)) 0 else this.taintKind.hashCode)) + result = ((result * 31) + (if ((this.annotations == null)) 0 else this.annotations.hashCode)) + result = ((result * 31) + (if ((this.message == null)) 0 else this.message.hashCode)) + result = ((result * 31) + (if ((this.targetKey == null)) 0 else this.targetKey.hashCode)) + result = ((result * 31) + (if ((this.target == null)) 0 else this.target.hashCode)) + result = ((result * 31) + (if ((this.threadId == null)) 0 else this.threadId.hashCode)) + result = ((result * 31) + (if ((this.fullyQualifiedLogicalName == null)) 0 else this.fullyQualifiedLogicalName.hashCode)) + result = ((result * 31) + (if ((this.logicalLocationKey == null)) 0 else this.logicalLocationKey.hashCode)) + result = ((result * 31) + (if ((this.step == null)) 0 else this.step.hashCode)) + result = ((result * 31) + (if ((this.id == null)) 0 else this.id.hashCode)) + result = ((result * 31) + (if ((this.state == null)) 0 else this.state.hashCode)) + result = ((result * 31) + (if ((this.properties == null)) 0 else this.properties.hashCode)) + result = ((result * 31) + (if ((this.essential == null)) 0 else this.essential.hashCode)) + result + } + + override def equals(other: Any): Boolean = { + if (other == this) { + return true + } + if ((other.isInstanceOf[AnnotatedCodeLocation]) == false) { + return false + } + val rhs = other.asInstanceOf[AnnotatedCodeLocation] + ((((((((((((((((((((this.snippet == rhs.snippet) || ((this.snippet != null) && this.snippet == rhs.snippet)) && ((this.physicalLocation == rhs.physicalLocation) || ((this.physicalLocation != null) && this.physicalLocation == rhs.physicalLocation))) && ((this.kind == rhs.kind) || ((this.kind != null) && this.kind == rhs.kind))) && ((this.importance == rhs.importance) || ((this.importance != null) && this.importance == rhs.importance))) && ((this.module == rhs.module) || ((this.module != null) && this.module == rhs.module))) && ((this.values == rhs.values) || ((this.values != null) && this.values == rhs.values))) && ((this.taintKind == rhs.taintKind) || ((this.taintKind != null) && this.taintKind == rhs.taintKind))) && ((this.annotations == rhs.annotations) || ((this.annotations != null) && this.annotations == rhs.annotations))) && ((this.message == rhs.message) || ((this.message != null) && this.message == rhs.message))) && ((this.targetKey == rhs.targetKey) || ((this.targetKey != null) && this.targetKey == rhs.targetKey))) && ((this.target == rhs.target) || ((this.target != null) && this.target == rhs.target))) && ((this.threadId == rhs.threadId) || ((this.threadId != null) && this.threadId == rhs.threadId))) && ((this.fullyQualifiedLogicalName == rhs.fullyQualifiedLogicalName) || ((this.fullyQualifiedLogicalName != null) && this.fullyQualifiedLogicalName == rhs.fullyQualifiedLogicalName))) && ((this.logicalLocationKey == rhs.logicalLocationKey) || ((this.logicalLocationKey != null) && this.logicalLocationKey == rhs.logicalLocationKey))) && ((this.step == rhs.step) || ((this.step != null) && this.step == rhs.step))) && ((this.id == rhs.id) || ((this.id != null) && this.id == rhs.id))) && ((this.state == rhs.state) || ((this.state != null) && this.state == rhs.state))) && ((this.properties == rhs.properties) || ((this.properties != null) && this.properties == rhs.properties))) && ((this.essential == rhs.essential) || ((this.essential != null) && this.essential == rhs.essential))) + } +} diff --git a/schema/scala-gen/Annotation.scala b/schema/scala-gen/Annotation.scala new file mode 100644 index 0000000..bf25433 --- /dev/null +++ b/schema/scala-gen/Annotation.scala @@ -0,0 +1,61 @@ +import java.util.ArrayList +import java.util.List +import com.fasterxml.jackson.annotation.JsonInclude +import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.annotation.JsonPropertyDescription +import com.fasterxml.jackson.annotation.JsonPropertyOrder +import scala.beans.{BeanProperty, BooleanBeanProperty} +//remove if not needed +import scala.collection.JavaConversions._ + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder(Array("message", "locations")) +class Annotation { + + @JsonProperty("message") + @JsonPropertyDescription("A message relevant to a code location") + @BeanProperty + var message: String = _ + + @JsonProperty("locations") + @JsonPropertyDescription("An array of 'physicalLocation' objects associated with the annotation.") + @BeanProperty + var locations: List[PhysicalLocation] = new ArrayList[PhysicalLocation]() + + override def toString(): String = { + val sb = new StringBuilder() + sb.append(classOf[Annotation].getName).append('@').append(java.lang.Integer.toHexString(System.identityHashCode(this))).append('[') + sb.append("message") + sb.append('=') + sb.append((if ((this.message == null)) "" else this.message)) + sb.append(',') + sb.append("locations") + sb.append('=') + sb.append((if ((this.locations == null)) "" else this.locations)) + sb.append(',') + if (sb.charAt((sb.length - 1)) == ',') { + sb.setCharAt((sb.length - 1), ']') + } else { + sb.append(']') + } + sb.toString + } + + override def hashCode(): Int = { + var result = 1 + result = ((result * 31) + (if ((this.message == null)) 0 else this.message.hashCode)) + result = ((result * 31) + (if ((this.locations == null)) 0 else this.locations.hashCode)) + result + } + + override def equals(other: Any): Boolean = { + if (other == this) { + return true + } + if ((other.isInstanceOf[Annotation]) == false) { + return false + } + val rhs = other.asInstanceOf[Annotation] + (((this.message == rhs.message) || ((this.message != null) && this.message == rhs.message)) && ((this.locations == rhs.locations) || ((this.locations != null) && this.locations == rhs.locations))) + } +} diff --git a/schema/scala-gen/CodeFlow.scala b/schema/scala-gen/CodeFlow.scala new file mode 100644 index 0000000..04540dc --- /dev/null +++ b/schema/scala-gen/CodeFlow.scala @@ -0,0 +1,71 @@ +import java.util.ArrayList +import java.util.List +import com.fasterxml.jackson.annotation.JsonInclude +import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.annotation.JsonPropertyDescription +import com.fasterxml.jackson.annotation.JsonPropertyOrder +import scala.beans.{BeanProperty, BooleanBeanProperty} +//remove if not needed +import scala.collection.JavaConversions._ + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder(Array("message", "locations", "properties")) +class CodeFlow { + + @JsonProperty("message") + @JsonPropertyDescription("A message relevant to the code flow") + @BeanProperty + var message: String = _ + + @JsonProperty("locations") + @JsonPropertyDescription("An array of 'annotatedCodeLocation' objects, each of which describes a single location visited by the tool in the course of producing the result.") + @BeanProperty + var locations: List[AnnotatedCodeLocation] = new ArrayList[AnnotatedCodeLocation]() + + @JsonProperty("properties") + @JsonPropertyDescription("Key/value pairs that provide additional information about the code flow.") + @BeanProperty + var properties: Properties__6 = _ + + override def toString(): String = { + val sb = new StringBuilder() + sb.append(classOf[CodeFlow].getName).append('@').append(java.lang.Integer.toHexString(System.identityHashCode(this))).append('[') + sb.append("message") + sb.append('=') + sb.append((if ((this.message == null)) "" else this.message)) + sb.append(',') + sb.append("locations") + sb.append('=') + sb.append((if ((this.locations == null)) "" else this.locations)) + sb.append(',') + sb.append("properties") + sb.append('=') + sb.append((if ((this.properties == null)) "" else this.properties)) + sb.append(',') + if (sb.charAt((sb.length - 1)) == ',') { + sb.setCharAt((sb.length - 1), ']') + } else { + sb.append(']') + } + sb.toString + } + + override def hashCode(): Int = { + var result = 1 + result = ((result * 31) + (if ((this.locations == null)) 0 else this.locations.hashCode)) + result = ((result * 31) + (if ((this.message == null)) 0 else this.message.hashCode)) + result = ((result * 31) + (if ((this.properties == null)) 0 else this.properties.hashCode)) + result + } + + override def equals(other: Any): Boolean = { + if (other == this) { + return true + } + if ((other.isInstanceOf[CodeFlow]) == false) { + return false + } + val rhs = other.asInstanceOf[CodeFlow] + ((((this.locations == rhs.locations) || ((this.locations != null) && this.locations == rhs.locations)) && ((this.message == rhs.message) || ((this.message != null) && this.message == rhs.message))) && ((this.properties == rhs.properties) || ((this.properties != null) && this.properties == rhs.properties))) + } +} diff --git a/schema/scala-gen/EnvironmentVariables.scala b/schema/scala-gen/EnvironmentVariables.scala new file mode 100644 index 0000000..4f89bcf --- /dev/null +++ b/schema/scala-gen/EnvironmentVariables.scala @@ -0,0 +1,36 @@ +import com.fasterxml.jackson.annotation.JsonInclude +import com.fasterxml.jackson.annotation.JsonPropertyOrder +//remove if not needed +import scala.collection.JavaConversions._ + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder(Array()) +class EnvironmentVariables { + + override def toString(): String = { + val sb = new StringBuilder() + sb.append(classOf[EnvironmentVariables].getName).append('@').append(java.lang.Integer.toHexString(System.identityHashCode(this))).append('[') + if (sb.charAt((sb.length - 1)) == ',') { + sb.setCharAt((sb.length - 1), ']') + } else { + sb.append(']') + } + sb.toString + } + + override def hashCode(): Int = { + val result = 1 + result + } + + override def equals(other: Any): Boolean = { + if (other == this) { + return true + } + if ((other.isInstanceOf[EnvironmentVariables]) == false) { + return false + } + val rhs = other.asInstanceOf[EnvironmentVariables] + true + } +} diff --git a/schema/scala-gen/Exception.scala b/schema/scala-gen/Exception.scala new file mode 100644 index 0000000..66019c1 --- /dev/null +++ b/schema/scala-gen/Exception.scala @@ -0,0 +1,81 @@ +import java.util.ArrayList +import java.util.List +import com.fasterxml.jackson.annotation.JsonInclude +import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.annotation.JsonPropertyDescription +import com.fasterxml.jackson.annotation.JsonPropertyOrder +import scala.beans.{BeanProperty, BooleanBeanProperty} +//remove if not needed +import scala.collection.JavaConversions._ + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder(Array("kind", "message", "stack", "innerExceptions")) +class Exception { + + @JsonProperty("kind") + @JsonPropertyDescription("A string that identifies the kind of exception, for example, the fully qualified type name of an object that was thrown, or the symbolic name of a signal.") + @BeanProperty + var kind: String = _ + + @JsonProperty("message") + @JsonPropertyDescription("A string that describes the exception.") + @BeanProperty + var message: String = _ + + @JsonProperty("stack") + @JsonPropertyDescription("A call stack that is relevant to a result.") + @BeanProperty + var stack: Stack = _ + + @JsonProperty("innerExceptions") + @JsonPropertyDescription("An array of exception objects each of which is considered a cause of this exception.") + @BeanProperty + var innerExceptions: List[Exception] = new ArrayList[Exception]() + + override def toString(): String = { + val sb = new StringBuilder() + sb.append(classOf[Exception].getName).append('@').append(java.lang.Integer.toHexString(System.identityHashCode(this))).append('[') + sb.append("kind") + sb.append('=') + sb.append((if ((this.kind == null)) "" else this.kind)) + sb.append(',') + sb.append("message") + sb.append('=') + sb.append((if ((this.message == null)) "" else this.message)) + sb.append(',') + sb.append("stack") + sb.append('=') + sb.append((if ((this.stack == null)) "" else this.stack)) + sb.append(',') + sb.append("innerExceptions") + sb.append('=') + sb.append((if ((this.innerExceptions == null)) "" else this.innerExceptions)) + sb.append(',') + if (sb.charAt((sb.length - 1)) == ',') { + sb.setCharAt((sb.length - 1), ']') + } else { + sb.append(']') + } + sb.toString + } + + override def hashCode(): Int = { + var result = 1 + result = ((result * 31) + (if ((this.stack == null)) 0 else this.stack.hashCode)) + result = ((result * 31) + (if ((this.innerExceptions == null)) 0 else this.innerExceptions.hashCode)) + result = ((result * 31) + (if ((this.message == null)) 0 else this.message.hashCode)) + result = ((result * 31) + (if ((this.kind == null)) 0 else this.kind.hashCode)) + result + } + + override def equals(other: Any): Boolean = { + if (other == this) { + return true + } + if ((other.isInstanceOf[Exception]) == false) { + return false + } + val rhs = other.asInstanceOf[Exception] + (((((this.stack == rhs.stack) || ((this.stack != null) && this.stack == rhs.stack)) && ((this.innerExceptions == rhs.innerExceptions) || ((this.innerExceptions != null) && this.innerExceptions == rhs.innerExceptions))) && ((this.message == rhs.message) || ((this.message != null) && this.message == rhs.message))) && ((this.kind == rhs.kind) || ((this.kind != null) && this.kind == rhs.kind))) + } +} diff --git a/schema/scala-gen/FileChange.scala b/schema/scala-gen/FileChange.scala new file mode 100644 index 0000000..5801ee2 --- /dev/null +++ b/schema/scala-gen/FileChange.scala @@ -0,0 +1,72 @@ +import java.net.URI +import java.util.ArrayList +import java.util.List +import com.fasterxml.jackson.annotation.JsonInclude +import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.annotation.JsonPropertyDescription +import com.fasterxml.jackson.annotation.JsonPropertyOrder +import scala.beans.{BeanProperty, BooleanBeanProperty} +//remove if not needed +import scala.collection.JavaConversions._ + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder(Array("uri", "uriBaseId", "replacements")) +class FileChange { + + @JsonProperty("uri") + @JsonPropertyDescription("A string that represents the location of the file to change as a valid URI.") + @BeanProperty + var uri: URI = _ + + @JsonProperty("uriBaseId") + @JsonPropertyDescription("A string that identifies the conceptual base for the 'uri' property (if it is relative), e.g.,'$(SolutionDir)' or '%SRCROOT%'.") + @BeanProperty + var uriBaseId: String = _ + + @JsonProperty("replacements") + @JsonPropertyDescription("An array of replacement objects, each of which represents the replacement of a single range of bytes in a single file specified by 'uri'.") + @BeanProperty + var replacements: List[Replacement] = new ArrayList[Replacement]() + + override def toString(): String = { + val sb = new StringBuilder() + sb.append(classOf[FileChange].getName).append('@').append(java.lang.Integer.toHexString(System.identityHashCode(this))).append('[') + sb.append("uri") + sb.append('=') + sb.append((if ((this.uri == null)) "" else this.uri)) + sb.append(',') + sb.append("uriBaseId") + sb.append('=') + sb.append((if ((this.uriBaseId == null)) "" else this.uriBaseId)) + sb.append(',') + sb.append("replacements") + sb.append('=') + sb.append((if ((this.replacements == null)) "" else this.replacements)) + sb.append(',') + if (sb.charAt((sb.length - 1)) == ',') { + sb.setCharAt((sb.length - 1), ']') + } else { + sb.append(']') + } + sb.toString + } + + override def hashCode(): Int = { + var result = 1 + result = ((result * 31) + (if ((this.replacements == null)) 0 else this.replacements.hashCode)) + result = ((result * 31) + (if ((this.uri == null)) 0 else this.uri.hashCode)) + result = ((result * 31) + (if ((this.uriBaseId == null)) 0 else this.uriBaseId.hashCode)) + result + } + + override def equals(other: Any): Boolean = { + if (other == this) { + return true + } + if ((other.isInstanceOf[FileChange]) == false) { + return false + } + val rhs = other.asInstanceOf[FileChange] + ((((this.replacements == rhs.replacements) || ((this.replacements != null) && this.replacements == rhs.replacements)) && ((this.uri == rhs.uri) || ((this.uri != null) && this.uri == rhs.uri))) && ((this.uriBaseId == rhs.uriBaseId) || ((this.uriBaseId != null) && this.uriBaseId == rhs.uriBaseId))) + } +} diff --git a/schema/scala-gen/Files.scala b/schema/scala-gen/Files.scala new file mode 100644 index 0000000..9152f27 --- /dev/null +++ b/schema/scala-gen/Files.scala @@ -0,0 +1,36 @@ +import com.fasterxml.jackson.annotation.JsonInclude +import com.fasterxml.jackson.annotation.JsonPropertyOrder +//remove if not needed +import scala.collection.JavaConversions._ + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder(Array()) +class Files { + + override def toString(): String = { + val sb = new StringBuilder() + sb.append(classOf[Files].getName).append('@').append(java.lang.Integer.toHexString(System.identityHashCode(this))).append('[') + if (sb.charAt((sb.length - 1)) == ',') { + sb.setCharAt((sb.length - 1), ']') + } else { + sb.append(']') + } + sb.toString + } + + override def hashCode(): Int = { + val result = 1 + result + } + + override def equals(other: Any): Boolean = { + if (other == this) { + return true + } + if ((other.isInstanceOf[Files]) == false) { + return false + } + val rhs = other.asInstanceOf[Files] + true + } +} diff --git a/schema/scala-gen/Fix.scala b/schema/scala-gen/Fix.scala new file mode 100644 index 0000000..1771efc --- /dev/null +++ b/schema/scala-gen/Fix.scala @@ -0,0 +1,61 @@ +import java.util.ArrayList +import java.util.List +import com.fasterxml.jackson.annotation.JsonInclude +import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.annotation.JsonPropertyDescription +import com.fasterxml.jackson.annotation.JsonPropertyOrder +import scala.beans.{BeanProperty, BooleanBeanProperty} +//remove if not needed +import scala.collection.JavaConversions._ + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder(Array("description", "fileChanges")) +class Fix { + + @JsonProperty("description") + @JsonPropertyDescription("A string that describes the proposed fix, enabling viewers to present a proposed change to an end user.") + @BeanProperty + var description: String = _ + + @JsonProperty("fileChanges") + @JsonPropertyDescription("One or more file changes that comprise a fix for a result.") + @BeanProperty + var fileChanges: List[FileChange] = new ArrayList[FileChange]() + + override def toString(): String = { + val sb = new StringBuilder() + sb.append(classOf[Fix].getName).append('@').append(java.lang.Integer.toHexString(System.identityHashCode(this))).append('[') + sb.append("description") + sb.append('=') + sb.append((if ((this.description == null)) "" else this.description)) + sb.append(',') + sb.append("fileChanges") + sb.append('=') + sb.append((if ((this.fileChanges == null)) "" else this.fileChanges)) + sb.append(',') + if (sb.charAt((sb.length - 1)) == ',') { + sb.setCharAt((sb.length - 1), ']') + } else { + sb.append(']') + } + sb.toString + } + + override def hashCode(): Int = { + var result = 1 + result = ((result * 31) + (if ((this.description == null)) 0 else this.description.hashCode)) + result = ((result * 31) + (if ((this.fileChanges == null)) 0 else this.fileChanges.hashCode)) + result + } + + override def equals(other: Any): Boolean = { + if (other == this) { + return true + } + if ((other.isInstanceOf[Fix]) == false) { + return false + } + val rhs = other.asInstanceOf[Fix] + (((this.description == rhs.description) || ((this.description != null) && this.description == rhs.description)) && ((this.fileChanges == rhs.fileChanges) || ((this.fileChanges != null) && this.fileChanges == rhs.fileChanges))) + } +} diff --git a/schema/scala-gen/FormattedRuleMessage.scala b/schema/scala-gen/FormattedRuleMessage.scala new file mode 100644 index 0000000..3655748 --- /dev/null +++ b/schema/scala-gen/FormattedRuleMessage.scala @@ -0,0 +1,61 @@ +import java.util.ArrayList +import java.util.List +import com.fasterxml.jackson.annotation.JsonInclude +import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.annotation.JsonPropertyDescription +import com.fasterxml.jackson.annotation.JsonPropertyOrder +import scala.beans.{BeanProperty, BooleanBeanProperty} +//remove if not needed +import scala.collection.JavaConversions._ + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder(Array("formatId", "arguments")) +class FormattedRuleMessage { + + @JsonProperty("formatId") + @JsonPropertyDescription("A string that identifies the message format used to format the message that describes this result. The value of formatId must correspond to one of the names in the set of name/value pairs contained in the 'messageFormats' property of the rule object whose 'id' property matches the 'ruleId' property of this result.") + @BeanProperty + var formatId: String = _ + + @JsonProperty("arguments") + @JsonPropertyDescription("An array of strings that will be used, in combination with a message format, to construct a result message.") + @BeanProperty + var arguments: List[String] = new ArrayList[String]() + + override def toString(): String = { + val sb = new StringBuilder() + sb.append(classOf[FormattedRuleMessage].getName).append('@').append(java.lang.Integer.toHexString(System.identityHashCode(this))).append('[') + sb.append("formatId") + sb.append('=') + sb.append((if ((this.formatId == null)) "" else this.formatId)) + sb.append(',') + sb.append("arguments") + sb.append('=') + sb.append((if ((this.arguments == null)) "" else this.arguments)) + sb.append(',') + if (sb.charAt((sb.length - 1)) == ',') { + sb.setCharAt((sb.length - 1), ']') + } else { + sb.append(']') + } + sb.toString + } + + override def hashCode(): Int = { + var result = 1 + result = ((result * 31) + (if ((this.arguments == null)) 0 else this.arguments.hashCode)) + result = ((result * 31) + (if ((this.formatId == null)) 0 else this.formatId.hashCode)) + result + } + + override def equals(other: Any): Boolean = { + if (other == this) { + return true + } + if ((other.isInstanceOf[FormattedRuleMessage]) == false) { + return false + } + val rhs = other.asInstanceOf[FormattedRuleMessage] + (((this.arguments == rhs.arguments) || ((this.arguments != null) && this.arguments == rhs.arguments)) && ((this.formatId == rhs.formatId) || ((this.formatId != null) && this.formatId == rhs.formatId))) + } +} diff --git a/schema/scala-gen/Invocation.scala b/schema/scala-gen/Invocation.scala new file mode 100644 index 0000000..fe7e4c2 --- /dev/null +++ b/schema/scala-gen/Invocation.scala @@ -0,0 +1,150 @@ +import java.util.Date +import com.fasterxml.jackson.annotation.JsonInclude +import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.annotation.JsonPropertyDescription +import com.fasterxml.jackson.annotation.JsonPropertyOrder +import scala.beans.{BeanProperty, BooleanBeanProperty} +//remove if not needed +import scala.collection.JavaConversions._ + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder(Array("commandLine", "responseFiles", "startTime", "endTime", "machine", "account", "processId", "fileName", "workingDirectory", "environmentVariables", "properties")) +class Invocation { + + @JsonProperty("commandLine") + @JsonPropertyDescription("The command line used to invoke the tool.") + @BeanProperty + var commandLine: String = _ + + @JsonProperty("responseFiles") + @JsonPropertyDescription("The contents of any response files specified on the tool's command line.") + @BeanProperty + var responseFiles: ResponseFiles = _ + + @JsonProperty("startTime") + @JsonPropertyDescription("The date and time at which the run started. See \"Date/time properties\" in the SARIF spec for the required format.") + @BeanProperty + var startTime: Date = _ + + @JsonProperty("endTime") + @JsonPropertyDescription("The date and time at which the run ended. See \"Date/time properties\" in the SARIF spec for the required format.") + @BeanProperty + var endTime: Date = _ + + @JsonProperty("machine") + @JsonPropertyDescription("The machine that hosted the analysis tool run.") + @BeanProperty + var machine: String = _ + + @JsonProperty("account") + @JsonPropertyDescription("The account that ran the analysis tool.") + @BeanProperty + var account: String = _ + + @JsonProperty("processId") + @JsonPropertyDescription("The process id for the analysis tool run.") + @BeanProperty + var processId: java.lang.Integer = _ + + @JsonProperty("fileName") + @JsonPropertyDescription("The fully qualified path to the analysis tool.") + @BeanProperty + var fileName: String = _ + + @JsonProperty("workingDirectory") + @JsonPropertyDescription("The working directory for the analysis rool run.") + @BeanProperty + var workingDirectory: String = _ + + @JsonProperty("environmentVariables") + @JsonPropertyDescription("The environment variables associated with the analysis tool process, expressed as key/value pairs.") + @BeanProperty + var environmentVariables: EnvironmentVariables = _ + + @JsonProperty("properties") + @JsonPropertyDescription("Key/value pairs that provide additional information about the run.") + @BeanProperty + var properties: Properties__1 = _ + + override def toString(): String = { + val sb = new StringBuilder() + sb.append(classOf[Invocation].getName).append('@').append(java.lang.Integer.toHexString(System.identityHashCode(this))).append('[') + sb.append("commandLine") + sb.append('=') + sb.append((if ((this.commandLine == null)) "" else this.commandLine)) + sb.append(',') + sb.append("responseFiles") + sb.append('=') + sb.append((if ((this.responseFiles == null)) "" else this.responseFiles)) + sb.append(',') + sb.append("startTime") + sb.append('=') + sb.append((if ((this.startTime == null)) "" else this.startTime)) + sb.append(',') + sb.append("endTime") + sb.append('=') + sb.append((if ((this.endTime == null)) "" else this.endTime)) + sb.append(',') + sb.append("machine") + sb.append('=') + sb.append((if ((this.machine == null)) "" else this.machine)) + sb.append(',') + sb.append("account") + sb.append('=') + sb.append((if ((this.account == null)) "" else this.account)) + sb.append(',') + sb.append("processId") + sb.append('=') + sb.append((if ((this.processId == null)) "" else this.processId)) + sb.append(',') + sb.append("fileName") + sb.append('=') + sb.append((if ((this.fileName == null)) "" else this.fileName)) + sb.append(',') + sb.append("workingDirectory") + sb.append('=') + sb.append((if ((this.workingDirectory == null)) "" else this.workingDirectory)) + sb.append(',') + sb.append("environmentVariables") + sb.append('=') + sb.append((if ((this.environmentVariables == null)) "" else this.environmentVariables)) + sb.append(',') + sb.append("properties") + sb.append('=') + sb.append((if ((this.properties == null)) "" else this.properties)) + sb.append(',') + if (sb.charAt((sb.length - 1)) == ',') { + sb.setCharAt((sb.length - 1), ']') + } else { + sb.append(']') + } + sb.toString + } + + override def hashCode(): Int = { + var result = 1 + result = ((result * 31) + (if ((this.fileName == null)) 0 else this.fileName.hashCode)) + result = ((result * 31) + (if ((this.processId == null)) 0 else this.processId.hashCode)) + result = ((result * 31) + (if ((this.workingDirectory == null)) 0 else this.workingDirectory.hashCode)) + result = ((result * 31) + (if ((this.machine == null)) 0 else this.machine.hashCode)) + result = ((result * 31) + (if ((this.environmentVariables == null)) 0 else this.environmentVariables.hashCode)) + result = ((result * 31) + (if ((this.responseFiles == null)) 0 else this.responseFiles.hashCode)) + result = ((result * 31) + (if ((this.startTime == null)) 0 else this.startTime.hashCode)) + result = ((result * 31) + (if ((this.endTime == null)) 0 else this.endTime.hashCode)) + result = ((result * 31) + (if ((this.commandLine == null)) 0 else this.commandLine.hashCode)) + result = ((result * 31) + (if ((this.account == null)) 0 else this.account.hashCode)) + result = ((result * 31) + (if ((this.properties == null)) 0 else this.properties.hashCode)) + result + } + + override def equals(other: Any): Boolean = { + if (other == this) { + return true + } + if ((other.isInstanceOf[Invocation]) == false) { + return false + } + val rhs = other.asInstanceOf[Invocation] + ((((((((((((this.fileName == rhs.fileName) || ((this.fileName != null) && this.fileName == rhs.fileName)) && ((this.processId == rhs.processId) || ((this.processId != null) && this.processId == rhs.processId))) && ((this.workingDirectory == rhs.workingDirectory) || ((this.workingDirectory != null) && this.workingDirectory == rhs.workingDirectory))) && ((this.machine == rhs.machine) || ((this.machine != null) && this.machine == rhs.machine))) && ((this.environmentVariables == rhs.environmentVariables) || ((this.environmentVariables != null) && this.environmentVariables == rhs.environmentVariables))) && ((this.responseFiles == rhs.responseFiles) || ((this.responseFiles != null) && this.responseFiles == rhs.responseFiles))) && ((this.startTime == rhs.startTime) || ((this.startTime != null) && this.startTime == rhs.startTime))) && ((this.endTime == rhs.endTime) || ((this.endTime != null) && this.endTime == rhs.endTime))) && ((this.commandLine == rhs.commandLine) || ((this.commandLine != null) && this.commandLine == rhs.commandLine))) && ((this.account == rhs.account) || ((this.account != null) && this.account == rhs.account))) && ((this.properties == rhs.properties) || ((this.properties != null) && this.properties == rhs.properties))) + } +} diff --git a/schema/scala-gen/Location.scala b/schema/scala-gen/Location.scala new file mode 100644 index 0000000..a70db82 --- /dev/null +++ b/schema/scala-gen/Location.scala @@ -0,0 +1,99 @@ +import com.fasterxml.jackson.annotation.JsonInclude +import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.annotation.JsonPropertyDescription +import com.fasterxml.jackson.annotation.JsonPropertyOrder +import scala.beans.{BeanProperty, BooleanBeanProperty} +//remove if not needed +import scala.collection.JavaConversions._ + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder(Array("analysisTarget", "resultFile", "fullyQualifiedLogicalName", "logicalLocationKey", "decoratedName", "properties")) +class Location { + + @JsonProperty("analysisTarget") + @JsonPropertyDescription("A physical location relevant to a result. Specifies a reference to a programming artifact together with a range of bytes or characters within that artifact.") + @BeanProperty + var analysisTarget: PhysicalLocation = _ + + @JsonProperty("resultFile") + @JsonPropertyDescription("A physical location relevant to a result. Specifies a reference to a programming artifact together with a range of bytes or characters within that artifact.") + @BeanProperty + var resultFile: PhysicalLocation = _ + + @JsonProperty("fullyQualifiedLogicalName") + @JsonPropertyDescription("The human-readable fully qualified name of the logical location where the analysis tool produced the result. If 'logicalLocationKey' is not specified, this member is can used to retrieve the location logicalLocation from the logicalLocations dictionary, if one exists.") + @BeanProperty + var fullyQualifiedLogicalName: String = _ + + @JsonProperty("logicalLocationKey") + @JsonPropertyDescription("A key used to retrieve the location logicalLocation from the logicalLocations dictionary, when the string specified by 'fullyQualifiedLogicalName' is not unique.") + @BeanProperty + var logicalLocationKey: String = _ + + @JsonProperty("decoratedName") + @JsonPropertyDescription("The machine-readable fully qualified name for the logical location where the analysis tool produced the result, such as the mangled function name provided by a C++ compiler that encodes calling convention, return type and other details along with the function name.") + @BeanProperty + var decoratedName: String = _ + + @JsonProperty("properties") + @JsonPropertyDescription("Key/value pairs that provide additional information about the location.") + @BeanProperty + var properties: Properties__2 = _ + + override def toString(): String = { + val sb = new StringBuilder() + sb.append(classOf[Location].getName).append('@').append(java.lang.Integer.toHexString(System.identityHashCode(this))).append('[') + sb.append("analysisTarget") + sb.append('=') + sb.append((if ((this.analysisTarget == null)) "" else this.analysisTarget)) + sb.append(',') + sb.append("resultFile") + sb.append('=') + sb.append((if ((this.resultFile == null)) "" else this.resultFile)) + sb.append(',') + sb.append("fullyQualifiedLogicalName") + sb.append('=') + sb.append((if ((this.fullyQualifiedLogicalName == null)) "" else this.fullyQualifiedLogicalName)) + sb.append(',') + sb.append("logicalLocationKey") + sb.append('=') + sb.append((if ((this.logicalLocationKey == null)) "" else this.logicalLocationKey)) + sb.append(',') + sb.append("decoratedName") + sb.append('=') + sb.append((if ((this.decoratedName == null)) "" else this.decoratedName)) + sb.append(',') + sb.append("properties") + sb.append('=') + sb.append((if ((this.properties == null)) "" else this.properties)) + sb.append(',') + if (sb.charAt((sb.length - 1)) == ',') { + sb.setCharAt((sb.length - 1), ']') + } else { + sb.append(']') + } + sb.toString + } + + override def hashCode(): Int = { + var result = 1 + result = ((result * 31) + (if ((this.fullyQualifiedLogicalName == null)) 0 else this.fullyQualifiedLogicalName.hashCode)) + result = ((result * 31) + (if ((this.logicalLocationKey == null)) 0 else this.logicalLocationKey.hashCode)) + result = ((result * 31) + (if ((this.decoratedName == null)) 0 else this.decoratedName.hashCode)) + result = ((result * 31) + (if ((this.resultFile == null)) 0 else this.resultFile.hashCode)) + result = ((result * 31) + (if ((this.analysisTarget == null)) 0 else this.analysisTarget.hashCode)) + result = ((result * 31) + (if ((this.properties == null)) 0 else this.properties.hashCode)) + result + } + + override def equals(other: Any): Boolean = { + if (other == this) { + return true + } + if ((other.isInstanceOf[Location]) == false) { + return false + } + val rhs = other.asInstanceOf[Location] + (((((((this.fullyQualifiedLogicalName == rhs.fullyQualifiedLogicalName) || ((this.fullyQualifiedLogicalName != null) && this.fullyQualifiedLogicalName == rhs.fullyQualifiedLogicalName)) && ((this.logicalLocationKey == rhs.logicalLocationKey) || ((this.logicalLocationKey != null) && this.logicalLocationKey == rhs.logicalLocationKey))) && ((this.decoratedName == rhs.decoratedName) || ((this.decoratedName != null) && this.decoratedName == rhs.decoratedName))) && ((this.resultFile == rhs.resultFile) || ((this.resultFile != null) && this.resultFile == rhs.resultFile))) && ((this.analysisTarget == rhs.analysisTarget) || ((this.analysisTarget != null) && this.analysisTarget == rhs.analysisTarget))) && ((this.properties == rhs.properties) || ((this.properties != null) && this.properties == rhs.properties))) + } +} diff --git a/schema/scala-gen/LogicalLocations.scala b/schema/scala-gen/LogicalLocations.scala new file mode 100644 index 0000000..7eb8da3 --- /dev/null +++ b/schema/scala-gen/LogicalLocations.scala @@ -0,0 +1,36 @@ +import com.fasterxml.jackson.annotation.JsonInclude +import com.fasterxml.jackson.annotation.JsonPropertyOrder +//remove if not needed +import scala.collection.JavaConversions._ + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder(Array()) +class LogicalLocations { + + override def toString(): String = { + val sb = new StringBuilder() + sb.append(classOf[LogicalLocations].getName).append('@').append(java.lang.Integer.toHexString(System.identityHashCode(this))).append('[') + if (sb.charAt((sb.length - 1)) == ',') { + sb.setCharAt((sb.length - 1), ']') + } else { + sb.append(']') + } + sb.toString + } + + override def hashCode(): Int = { + val result = 1 + result + } + + override def equals(other: Any): Boolean = { + if (other == this) { + return true + } + if ((other.isInstanceOf[LogicalLocations]) == false) { + return false + } + val rhs = other.asInstanceOf[LogicalLocations] + true + } +} diff --git a/schema/scala-gen/Notification.scala b/schema/scala-gen/Notification.scala new file mode 100644 index 0000000..8834ce1 --- /dev/null +++ b/schema/scala-gen/Notification.scala @@ -0,0 +1,179 @@ +import java.util.Date +import java.util.HashMap +import java.util.Map +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonInclude +import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.annotation.JsonPropertyDescription +import com.fasterxml.jackson.annotation.JsonPropertyOrder +import com.fasterxml.jackson.annotation.JsonValue +import Notification._ +import scala.beans.{BeanProperty, BooleanBeanProperty} +//remove if not needed +import scala.collection.JavaConversions._ + +object Notification { + + object Level extends Enumeration { + + val NOTE = new Level("note") + + val WARNING = new Level("warning") + + val ERROR = new Level("error") + + class Level private (var value: String) extends Val { + + override def toString(): String = this.value + } + + private val CONSTANTS = new HashMap[String, Notification.Level]() + + for (c <- values) { + CONSTANTS.put(c.value, c) + } + + @JsonCreator + def fromValue(value: String): Notification.Level = { + val constant = CONSTANTS.get(value) + if (constant == null) { + throw new IllegalArgumentException(value) + } else { + constant + } + } + + implicit def convertValue(v: Value): Level = v.asInstanceOf[Level] + } +} + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder(Array("id", "ruleId", "ruleKey", "physicalLocation", "message", "level", "threadId", "time", "exception", "properties")) +class Notification { + + @JsonProperty("id") + @JsonPropertyDescription("An identifier for the condition that was encountered.") + @BeanProperty + var id: String = _ + + @JsonProperty("ruleId") + @JsonPropertyDescription("The stable, unique identifier of the rule (if any) to which this notification is relevant. If 'ruleKey' is not specified, this member can be used to retrieve rule metadata from the rules dictionary, if it exists.") + @BeanProperty + var ruleId: String = _ + + @JsonProperty("ruleKey") + @JsonPropertyDescription("A key used to retrieve the rule metadata from the rules dictionary that is relevant to the notificationn.") + @BeanProperty + var ruleKey: String = _ + + @JsonProperty("physicalLocation") + @JsonPropertyDescription("A physical location relevant to a result. Specifies a reference to a programming artifact together with a range of bytes or characters within that artifact.") + @BeanProperty + var physicalLocation: PhysicalLocation = _ + + @JsonProperty("message") + @JsonPropertyDescription("A string that describes the condition that was encountered.") + @BeanProperty + var message: String = _ + + @JsonProperty("level") + @JsonPropertyDescription("A value specifying the severity level of the notification.") + @BeanProperty + var level: Notification.Level = Notification.Level.fromValue("warning") + + @JsonProperty("threadId") + @JsonPropertyDescription("The thread identifier of the code that generated the notification.") + @BeanProperty + var threadId: java.lang.Integer = _ + + @JsonProperty("time") + @JsonPropertyDescription("The date and time at which the analysis tool generated the notification.") + @BeanProperty + var time: Date = _ + + @JsonProperty("exception") + @BeanProperty + var exception: Exception = _ + + @JsonProperty("properties") + @JsonPropertyDescription("Key/value pairs that provide additional information about the notification.") + @BeanProperty + var properties: Properties__8 = _ + + override def toString(): String = { + val sb = new StringBuilder() + sb.append(classOf[Notification].getName).append('@').append(java.lang.Integer.toHexString(System.identityHashCode(this))).append('[') + sb.append("id") + sb.append('=') + sb.append((if ((this.id == null)) "" else this.id)) + sb.append(',') + sb.append("ruleId") + sb.append('=') + sb.append((if ((this.ruleId == null)) "" else this.ruleId)) + sb.append(',') + sb.append("ruleKey") + sb.append('=') + sb.append((if ((this.ruleKey == null)) "" else this.ruleKey)) + sb.append(',') + sb.append("physicalLocation") + sb.append('=') + sb.append((if ((this.physicalLocation == null)) "" else this.physicalLocation)) + sb.append(',') + sb.append("message") + sb.append('=') + sb.append((if ((this.message == null)) "" else this.message)) + sb.append(',') + sb.append("level") + sb.append('=') + sb.append((if ((this.level == null)) "" else this.level)) + sb.append(',') + sb.append("threadId") + sb.append('=') + sb.append((if ((this.threadId == null)) "" else this.threadId)) + sb.append(',') + sb.append("time") + sb.append('=') + sb.append((if ((this.time == null)) "" else this.time)) + sb.append(',') + sb.append("exception") + sb.append('=') + sb.append((if ((this.exception == null)) "" else this.exception)) + sb.append(',') + sb.append("properties") + sb.append('=') + sb.append((if ((this.properties == null)) "" else this.properties)) + sb.append(',') + if (sb.charAt((sb.length - 1)) == ',') { + sb.setCharAt((sb.length - 1), ']') + } else { + sb.append(']') + } + sb.toString + } + + override def hashCode(): Int = { + var result = 1 + result = ((result * 31) + (if ((this.threadId == null)) 0 else this.threadId.hashCode)) + result = ((result * 31) + (if ((this.exception == null)) 0 else this.exception.hashCode)) + result = ((result * 31) + (if ((this.physicalLocation == null)) 0 else this.physicalLocation.hashCode)) + result = ((result * 31) + (if ((this.level == null)) 0 else this.level.hashCode)) + result = ((result * 31) + (if ((this.id == null)) 0 else this.id.hashCode)) + result = ((result * 31) + (if ((this.time == null)) 0 else this.time.hashCode)) + result = ((result * 31) + (if ((this.ruleId == null)) 0 else this.ruleId.hashCode)) + result = ((result * 31) + (if ((this.message == null)) 0 else this.message.hashCode)) + result = ((result * 31) + (if ((this.ruleKey == null)) 0 else this.ruleKey.hashCode)) + result = ((result * 31) + (if ((this.properties == null)) 0 else this.properties.hashCode)) + result + } + + override def equals(other: Any): Boolean = { + if (other == this) { + return true + } + if ((other.isInstanceOf[Notification]) == false) { + return false + } + val rhs = other.asInstanceOf[Notification] + (((((((((((this.threadId == rhs.threadId) || ((this.threadId != null) && this.threadId == rhs.threadId)) && ((this.exception == rhs.exception) || ((this.exception != null) && this.exception == rhs.exception))) && ((this.physicalLocation == rhs.physicalLocation) || ((this.physicalLocation != null) && this.physicalLocation == rhs.physicalLocation))) && ((this.level == rhs.level) || ((this.level != null) && this.level == rhs.level))) && ((this.id == rhs.id) || ((this.id != null) && this.id == rhs.id))) && ((this.time == rhs.time) || ((this.time != null) && this.time == rhs.time))) && ((this.ruleId == rhs.ruleId) || ((this.ruleId != null) && this.ruleId == rhs.ruleId))) && ((this.message == rhs.message) || ((this.message != null) && this.message == rhs.message))) && ((this.ruleKey == rhs.ruleKey) || ((this.ruleKey != null) && this.ruleKey == rhs.ruleKey))) && ((this.properties == rhs.properties) || ((this.properties != null) && this.properties == rhs.properties))) + } +} diff --git a/schema/scala-gen/PhysicalLocation.scala b/schema/scala-gen/PhysicalLocation.scala new file mode 100644 index 0000000..f1b1e81 --- /dev/null +++ b/schema/scala-gen/PhysicalLocation.scala @@ -0,0 +1,70 @@ +import java.net.URI +import com.fasterxml.jackson.annotation.JsonInclude +import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.annotation.JsonPropertyDescription +import com.fasterxml.jackson.annotation.JsonPropertyOrder +import scala.beans.{BeanProperty, BooleanBeanProperty} +//remove if not needed +import scala.collection.JavaConversions._ + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder(Array("uri", "uriBaseId", "region")) +class PhysicalLocation { + + @JsonProperty("uri") + @JsonPropertyDescription("The location of the file as a valid URI.") + @BeanProperty + var uri: URI = _ + + @JsonProperty("uriBaseId") + @JsonPropertyDescription("A string that identifies the conceptual base for the 'uri' property (if it is relative), e.g.,'$(SolutionDir)' or '%SRCROOT%'.") + @BeanProperty + var uriBaseId: String = _ + + @JsonProperty("region") + @JsonPropertyDescription("A region within a file where a result was detected.") + @BeanProperty + var region: Region = _ + + override def toString(): String = { + val sb = new StringBuilder() + sb.append(classOf[PhysicalLocation].getName).append('@').append(java.lang.Integer.toHexString(System.identityHashCode(this))).append('[') + sb.append("uri") + sb.append('=') + sb.append((if ((this.uri == null)) "" else this.uri)) + sb.append(',') + sb.append("uriBaseId") + sb.append('=') + sb.append((if ((this.uriBaseId == null)) "" else this.uriBaseId)) + sb.append(',') + sb.append("region") + sb.append('=') + sb.append((if ((this.region == null)) "" else this.region)) + sb.append(',') + if (sb.charAt((sb.length - 1)) == ',') { + sb.setCharAt((sb.length - 1), ']') + } else { + sb.append(']') + } + sb.toString + } + + override def hashCode(): Int = { + var result = 1 + result = ((result * 31) + (if ((this.region == null)) 0 else this.region.hashCode)) + result = ((result * 31) + (if ((this.uri == null)) 0 else this.uri.hashCode)) + result = ((result * 31) + (if ((this.uriBaseId == null)) 0 else this.uriBaseId.hashCode)) + result + } + + override def equals(other: Any): Boolean = { + if (other == this) { + return true + } + if ((other.isInstanceOf[PhysicalLocation]) == false) { + return false + } + val rhs = other.asInstanceOf[PhysicalLocation] + ((((this.region == rhs.region) || ((this.region != null) && this.region == rhs.region)) && ((this.uri == rhs.uri) || ((this.uri != null) && this.uri == rhs.uri))) && ((this.uriBaseId == rhs.uriBaseId) || ((this.uriBaseId != null) && this.uriBaseId == rhs.uriBaseId))) + } +} diff --git a/schema/scala-gen/Properties.scala b/schema/scala-gen/Properties.scala new file mode 100644 index 0000000..259e35e --- /dev/null +++ b/schema/scala-gen/Properties.scala @@ -0,0 +1,53 @@ +import java.util.LinkedHashSet +import java.util.Set +import com.fasterxml.jackson.annotation.JsonInclude +import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.annotation.JsonPropertyDescription +import com.fasterxml.jackson.annotation.JsonPropertyOrder +import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import scala.beans.{BeanProperty, BooleanBeanProperty} +//remove if not needed +import scala.collection.JavaConversions._ + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder(Array("tags")) +class Properties { + + @JsonProperty("tags") + @JsonDeserialize(as = classOf[java.util.LinkedHashSet]) + @JsonPropertyDescription("A set of distinct strings that provide additional information.") + @BeanProperty + var tags: Set[String] = new LinkedHashSet[String]() + + override def toString(): String = { + val sb = new StringBuilder() + sb.append(classOf[Properties].getName).append('@').append(java.lang.Integer.toHexString(System.identityHashCode(this))).append('[') + sb.append("tags") + sb.append('=') + sb.append((if ((this.tags == null)) "" else this.tags)) + sb.append(',') + if (sb.charAt((sb.length - 1)) == ',') { + sb.setCharAt((sb.length - 1), ']') + } else { + sb.append(']') + } + sb.toString + } + + override def hashCode(): Int = { + var result = 1 + result = ((result * 31) + (if ((this.tags == null)) 0 else this.tags.hashCode)) + result + } + + override def equals(other: Any): Boolean = { + if (other == this) { + return true + } + if ((other.isInstanceOf[Properties]) == false) { + return false + } + val rhs = other.asInstanceOf[Properties] + ((this.tags == rhs.tags) || ((this.tags != null) && this.tags == rhs.tags)) + } +} diff --git a/schema/scala-gen/Properties__1.scala b/schema/scala-gen/Properties__1.scala new file mode 100644 index 0000000..b6fcf9a --- /dev/null +++ b/schema/scala-gen/Properties__1.scala @@ -0,0 +1,53 @@ +import java.util.LinkedHashSet +import java.util.Set +import com.fasterxml.jackson.annotation.JsonInclude +import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.annotation.JsonPropertyDescription +import com.fasterxml.jackson.annotation.JsonPropertyOrder +import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import scala.beans.{BeanProperty, BooleanBeanProperty} +//remove if not needed +import scala.collection.JavaConversions._ + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder(Array("tags")) +class Properties__1 { + + @JsonProperty("tags") + @JsonDeserialize(as = classOf[java.util.LinkedHashSet]) + @JsonPropertyDescription("A set of distinct strings that provide additional information.") + @BeanProperty + var tags: Set[String] = new LinkedHashSet[String]() + + override def toString(): String = { + val sb = new StringBuilder() + sb.append(classOf[Properties__1].getName).append('@').append(java.lang.Integer.toHexString(System.identityHashCode(this))).append('[') + sb.append("tags") + sb.append('=') + sb.append((if ((this.tags == null)) "" else this.tags)) + sb.append(',') + if (sb.charAt((sb.length - 1)) == ',') { + sb.setCharAt((sb.length - 1), ']') + } else { + sb.append(']') + } + sb.toString + } + + override def hashCode(): Int = { + var result = 1 + result = ((result * 31) + (if ((this.tags == null)) 0 else this.tags.hashCode)) + result + } + + override def equals(other: Any): Boolean = { + if (other == this) { + return true + } + if ((other.isInstanceOf[Properties__1]) == false) { + return false + } + val rhs = other.asInstanceOf[Properties__1] + ((this.tags == rhs.tags) || ((this.tags != null) && this.tags == rhs.tags)) + } +} diff --git a/schema/scala-gen/Properties__2.scala b/schema/scala-gen/Properties__2.scala new file mode 100644 index 0000000..eb63cb1 --- /dev/null +++ b/schema/scala-gen/Properties__2.scala @@ -0,0 +1,53 @@ +import java.util.LinkedHashSet +import java.util.Set +import com.fasterxml.jackson.annotation.JsonInclude +import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.annotation.JsonPropertyDescription +import com.fasterxml.jackson.annotation.JsonPropertyOrder +import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import scala.beans.{BeanProperty, BooleanBeanProperty} +//remove if not needed +import scala.collection.JavaConversions._ + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder(Array("tags")) +class Properties__2 { + + @JsonProperty("tags") + @JsonDeserialize(as = classOf[java.util.LinkedHashSet]) + @JsonPropertyDescription("A set of distinct strings that provide additional information.") + @BeanProperty + var tags: Set[String] = new LinkedHashSet[String]() + + override def toString(): String = { + val sb = new StringBuilder() + sb.append(classOf[Properties__2].getName).append('@').append(java.lang.Integer.toHexString(System.identityHashCode(this))).append('[') + sb.append("tags") + sb.append('=') + sb.append((if ((this.tags == null)) "" else this.tags)) + sb.append(',') + if (sb.charAt((sb.length - 1)) == ',') { + sb.setCharAt((sb.length - 1), ']') + } else { + sb.append(']') + } + sb.toString + } + + override def hashCode(): Int = { + var result = 1 + result = ((result * 31) + (if ((this.tags == null)) 0 else this.tags.hashCode)) + result + } + + override def equals(other: Any): Boolean = { + if (other == this) { + return true + } + if ((other.isInstanceOf[Properties__2]) == false) { + return false + } + val rhs = other.asInstanceOf[Properties__2] + ((this.tags == rhs.tags) || ((this.tags != null) && this.tags == rhs.tags)) + } +} diff --git a/schema/scala-gen/Properties__3.scala b/schema/scala-gen/Properties__3.scala new file mode 100644 index 0000000..61bb025 --- /dev/null +++ b/schema/scala-gen/Properties__3.scala @@ -0,0 +1,53 @@ +import java.util.LinkedHashSet +import java.util.Set +import com.fasterxml.jackson.annotation.JsonInclude +import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.annotation.JsonPropertyDescription +import com.fasterxml.jackson.annotation.JsonPropertyOrder +import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import scala.beans.{BeanProperty, BooleanBeanProperty} +//remove if not needed +import scala.collection.JavaConversions._ + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder(Array("tags")) +class Properties__3 { + + @JsonProperty("tags") + @JsonDeserialize(as = classOf[java.util.LinkedHashSet]) + @JsonPropertyDescription("A set of distinct strings that provide additional information.") + @BeanProperty + var tags: Set[String] = new LinkedHashSet[String]() + + override def toString(): String = { + val sb = new StringBuilder() + sb.append(classOf[Properties__3].getName).append('@').append(java.lang.Integer.toHexString(System.identityHashCode(this))).append('[') + sb.append("tags") + sb.append('=') + sb.append((if ((this.tags == null)) "" else this.tags)) + sb.append(',') + if (sb.charAt((sb.length - 1)) == ',') { + sb.setCharAt((sb.length - 1), ']') + } else { + sb.append(']') + } + sb.toString + } + + override def hashCode(): Int = { + var result = 1 + result = ((result * 31) + (if ((this.tags == null)) 0 else this.tags.hashCode)) + result + } + + override def equals(other: Any): Boolean = { + if (other == this) { + return true + } + if ((other.isInstanceOf[Properties__3]) == false) { + return false + } + val rhs = other.asInstanceOf[Properties__3] + ((this.tags == rhs.tags) || ((this.tags != null) && this.tags == rhs.tags)) + } +} diff --git a/schema/scala-gen/Properties__4.scala b/schema/scala-gen/Properties__4.scala new file mode 100644 index 0000000..5594639 --- /dev/null +++ b/schema/scala-gen/Properties__4.scala @@ -0,0 +1,53 @@ +import java.util.LinkedHashSet +import java.util.Set +import com.fasterxml.jackson.annotation.JsonInclude +import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.annotation.JsonPropertyDescription +import com.fasterxml.jackson.annotation.JsonPropertyOrder +import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import scala.beans.{BeanProperty, BooleanBeanProperty} +//remove if not needed +import scala.collection.JavaConversions._ + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder(Array("tags")) +class Properties__4 { + + @JsonProperty("tags") + @JsonDeserialize(as = classOf[java.util.LinkedHashSet]) + @JsonPropertyDescription("A set of distinct strings that provide additional information.") + @BeanProperty + var tags: Set[String] = new LinkedHashSet[String]() + + override def toString(): String = { + val sb = new StringBuilder() + sb.append(classOf[Properties__4].getName).append('@').append(java.lang.Integer.toHexString(System.identityHashCode(this))).append('[') + sb.append("tags") + sb.append('=') + sb.append((if ((this.tags == null)) "" else this.tags)) + sb.append(',') + if (sb.charAt((sb.length - 1)) == ',') { + sb.setCharAt((sb.length - 1), ']') + } else { + sb.append(']') + } + sb.toString + } + + override def hashCode(): Int = { + var result = 1 + result = ((result * 31) + (if ((this.tags == null)) 0 else this.tags.hashCode)) + result + } + + override def equals(other: Any): Boolean = { + if (other == this) { + return true + } + if ((other.isInstanceOf[Properties__4]) == false) { + return false + } + val rhs = other.asInstanceOf[Properties__4] + ((this.tags == rhs.tags) || ((this.tags != null) && this.tags == rhs.tags)) + } +} diff --git a/schema/scala-gen/Properties__5.scala b/schema/scala-gen/Properties__5.scala new file mode 100644 index 0000000..bd92b36 --- /dev/null +++ b/schema/scala-gen/Properties__5.scala @@ -0,0 +1,53 @@ +import java.util.LinkedHashSet +import java.util.Set +import com.fasterxml.jackson.annotation.JsonInclude +import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.annotation.JsonPropertyDescription +import com.fasterxml.jackson.annotation.JsonPropertyOrder +import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import scala.beans.{BeanProperty, BooleanBeanProperty} +//remove if not needed +import scala.collection.JavaConversions._ + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder(Array("tags")) +class Properties__5 { + + @JsonProperty("tags") + @JsonDeserialize(as = classOf[java.util.LinkedHashSet]) + @JsonPropertyDescription("A set of distinct strings that provide additional information.") + @BeanProperty + var tags: Set[String] = new LinkedHashSet[String]() + + override def toString(): String = { + val sb = new StringBuilder() + sb.append(classOf[Properties__5].getName).append('@').append(java.lang.Integer.toHexString(System.identityHashCode(this))).append('[') + sb.append("tags") + sb.append('=') + sb.append((if ((this.tags == null)) "" else this.tags)) + sb.append(',') + if (sb.charAt((sb.length - 1)) == ',') { + sb.setCharAt((sb.length - 1), ']') + } else { + sb.append(']') + } + sb.toString + } + + override def hashCode(): Int = { + var result = 1 + result = ((result * 31) + (if ((this.tags == null)) 0 else this.tags.hashCode)) + result + } + + override def equals(other: Any): Boolean = { + if (other == this) { + return true + } + if ((other.isInstanceOf[Properties__5]) == false) { + return false + } + val rhs = other.asInstanceOf[Properties__5] + ((this.tags == rhs.tags) || ((this.tags != null) && this.tags == rhs.tags)) + } +} diff --git a/schema/scala-gen/Properties__6.scala b/schema/scala-gen/Properties__6.scala new file mode 100644 index 0000000..0f4b017 --- /dev/null +++ b/schema/scala-gen/Properties__6.scala @@ -0,0 +1,53 @@ +import java.util.LinkedHashSet +import java.util.Set +import com.fasterxml.jackson.annotation.JsonInclude +import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.annotation.JsonPropertyDescription +import com.fasterxml.jackson.annotation.JsonPropertyOrder +import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import scala.beans.{BeanProperty, BooleanBeanProperty} +//remove if not needed +import scala.collection.JavaConversions._ + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder(Array("tags")) +class Properties__6 { + + @JsonProperty("tags") + @JsonDeserialize(as = classOf[java.util.LinkedHashSet]) + @JsonPropertyDescription("A set of distinct strings that provide additional information.") + @BeanProperty + var tags: Set[String] = new LinkedHashSet[String]() + + override def toString(): String = { + val sb = new StringBuilder() + sb.append(classOf[Properties__6].getName).append('@').append(java.lang.Integer.toHexString(System.identityHashCode(this))).append('[') + sb.append("tags") + sb.append('=') + sb.append((if ((this.tags == null)) "" else this.tags)) + sb.append(',') + if (sb.charAt((sb.length - 1)) == ',') { + sb.setCharAt((sb.length - 1), ']') + } else { + sb.append(']') + } + sb.toString + } + + override def hashCode(): Int = { + var result = 1 + result = ((result * 31) + (if ((this.tags == null)) 0 else this.tags.hashCode)) + result + } + + override def equals(other: Any): Boolean = { + if (other == this) { + return true + } + if ((other.isInstanceOf[Properties__6]) == false) { + return false + } + val rhs = other.asInstanceOf[Properties__6] + ((this.tags == rhs.tags) || ((this.tags != null) && this.tags == rhs.tags)) + } +} diff --git a/schema/scala-gen/Properties__7.scala b/schema/scala-gen/Properties__7.scala new file mode 100644 index 0000000..a8db90e --- /dev/null +++ b/schema/scala-gen/Properties__7.scala @@ -0,0 +1,53 @@ +import java.util.LinkedHashSet +import java.util.Set +import com.fasterxml.jackson.annotation.JsonInclude +import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.annotation.JsonPropertyDescription +import com.fasterxml.jackson.annotation.JsonPropertyOrder +import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import scala.beans.{BeanProperty, BooleanBeanProperty} +//remove if not needed +import scala.collection.JavaConversions._ + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder(Array("tags")) +class Properties__7 { + + @JsonProperty("tags") + @JsonDeserialize(as = classOf[java.util.LinkedHashSet]) + @JsonPropertyDescription("A set of distinct strings that provide additional information.") + @BeanProperty + var tags: Set[String] = new LinkedHashSet[String]() + + override def toString(): String = { + val sb = new StringBuilder() + sb.append(classOf[Properties__7].getName).append('@').append(java.lang.Integer.toHexString(System.identityHashCode(this))).append('[') + sb.append("tags") + sb.append('=') + sb.append((if ((this.tags == null)) "" else this.tags)) + sb.append(',') + if (sb.charAt((sb.length - 1)) == ',') { + sb.setCharAt((sb.length - 1), ']') + } else { + sb.append(']') + } + sb.toString + } + + override def hashCode(): Int = { + var result = 1 + result = ((result * 31) + (if ((this.tags == null)) 0 else this.tags.hashCode)) + result + } + + override def equals(other: Any): Boolean = { + if (other == this) { + return true + } + if ((other.isInstanceOf[Properties__7]) == false) { + return false + } + val rhs = other.asInstanceOf[Properties__7] + ((this.tags == rhs.tags) || ((this.tags != null) && this.tags == rhs.tags)) + } +} diff --git a/schema/scala-gen/Properties__8.scala b/schema/scala-gen/Properties__8.scala new file mode 100644 index 0000000..3eaef8d --- /dev/null +++ b/schema/scala-gen/Properties__8.scala @@ -0,0 +1,53 @@ +import java.util.LinkedHashSet +import java.util.Set +import com.fasterxml.jackson.annotation.JsonInclude +import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.annotation.JsonPropertyDescription +import com.fasterxml.jackson.annotation.JsonPropertyOrder +import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import scala.beans.{BeanProperty, BooleanBeanProperty} +//remove if not needed +import scala.collection.JavaConversions._ + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder(Array("tags")) +class Properties__8 { + + @JsonProperty("tags") + @JsonDeserialize(as = classOf[java.util.LinkedHashSet]) + @JsonPropertyDescription("A set of distinct strings that provide additional information.") + @BeanProperty + var tags: Set[String] = new LinkedHashSet[String]() + + override def toString(): String = { + val sb = new StringBuilder() + sb.append(classOf[Properties__8].getName).append('@').append(java.lang.Integer.toHexString(System.identityHashCode(this))).append('[') + sb.append("tags") + sb.append('=') + sb.append((if ((this.tags == null)) "" else this.tags)) + sb.append(',') + if (sb.charAt((sb.length - 1)) == ',') { + sb.setCharAt((sb.length - 1), ']') + } else { + sb.append(']') + } + sb.toString + } + + override def hashCode(): Int = { + var result = 1 + result = ((result * 31) + (if ((this.tags == null)) 0 else this.tags.hashCode)) + result + } + + override def equals(other: Any): Boolean = { + if (other == this) { + return true + } + if ((other.isInstanceOf[Properties__8]) == false) { + return false + } + val rhs = other.asInstanceOf[Properties__8] + ((this.tags == rhs.tags) || ((this.tags != null) && this.tags == rhs.tags)) + } +} diff --git a/schema/scala-gen/Properties__9.scala b/schema/scala-gen/Properties__9.scala new file mode 100644 index 0000000..1a91a07 --- /dev/null +++ b/schema/scala-gen/Properties__9.scala @@ -0,0 +1,53 @@ +import java.util.LinkedHashSet +import java.util.Set +import com.fasterxml.jackson.annotation.JsonInclude +import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.annotation.JsonPropertyDescription +import com.fasterxml.jackson.annotation.JsonPropertyOrder +import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import scala.beans.{BeanProperty, BooleanBeanProperty} +//remove if not needed +import scala.collection.JavaConversions._ + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder(Array("tags")) +class Properties__9 { + + @JsonProperty("tags") + @JsonDeserialize(as = classOf[java.util.LinkedHashSet]) + @JsonPropertyDescription("A set of distinct strings that provide additional information about the run.") + @BeanProperty + var tags: Set[String] = new LinkedHashSet[String]() + + override def toString(): String = { + val sb = new StringBuilder() + sb.append(classOf[Properties__9].getName).append('@').append(java.lang.Integer.toHexString(System.identityHashCode(this))).append('[') + sb.append("tags") + sb.append('=') + sb.append((if ((this.tags == null)) "" else this.tags)) + sb.append(',') + if (sb.charAt((sb.length - 1)) == ',') { + sb.setCharAt((sb.length - 1), ']') + } else { + sb.append(']') + } + sb.toString + } + + override def hashCode(): Int = { + var result = 1 + result = ((result * 31) + (if ((this.tags == null)) 0 else this.tags.hashCode)) + result + } + + override def equals(other: Any): Boolean = { + if (other == this) { + return true + } + if ((other.isInstanceOf[Properties__9]) == false) { + return false + } + val rhs = other.asInstanceOf[Properties__9] + ((this.tags == rhs.tags) || ((this.tags != null) && this.tags == rhs.tags)) + } +} diff --git a/schema/scala-gen/Region.scala b/schema/scala-gen/Region.scala new file mode 100644 index 0000000..bb125c1 --- /dev/null +++ b/schema/scala-gen/Region.scala @@ -0,0 +1,99 @@ +import com.fasterxml.jackson.annotation.JsonInclude +import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.annotation.JsonPropertyDescription +import com.fasterxml.jackson.annotation.JsonPropertyOrder +import scala.beans.{BeanProperty, BooleanBeanProperty} +//remove if not needed +import scala.collection.JavaConversions._ + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder(Array("startLine", "startColumn", "endLine", "endColumn", "offset", "length")) +class Region { + + @JsonProperty("startLine") + @JsonPropertyDescription("The line number of the first character in the region.") + @BeanProperty + var startLine: java.lang.Integer = _ + + @JsonProperty("startColumn") + @JsonPropertyDescription("The column number of the first character in the region.") + @BeanProperty + var startColumn: java.lang.Integer = _ + + @JsonProperty("endLine") + @JsonPropertyDescription("The line number of the last character in the region.") + @BeanProperty + var endLine: java.lang.Integer = _ + + @JsonProperty("endColumn") + @JsonPropertyDescription("The column number of the last character in the region.") + @BeanProperty + var endColumn: java.lang.Integer = _ + + @JsonProperty("offset") + @JsonPropertyDescription("The zero-based offset from the beginning of the file of the first byte or character in the region.") + @BeanProperty + var offset: java.lang.Integer = _ + + @JsonProperty("length") + @JsonPropertyDescription("The length of the region in bytes or characters.") + @BeanProperty + var length: java.lang.Integer = _ + + override def toString(): String = { + val sb = new StringBuilder() + sb.append(classOf[Region].getName).append('@').append(java.lang.Integer.toHexString(System.identityHashCode(this))).append('[') + sb.append("startLine") + sb.append('=') + sb.append((if ((this.startLine == null)) "" else this.startLine)) + sb.append(',') + sb.append("startColumn") + sb.append('=') + sb.append((if ((this.startColumn == null)) "" else this.startColumn)) + sb.append(',') + sb.append("endLine") + sb.append('=') + sb.append((if ((this.endLine == null)) "" else this.endLine)) + sb.append(',') + sb.append("endColumn") + sb.append('=') + sb.append((if ((this.endColumn == null)) "" else this.endColumn)) + sb.append(',') + sb.append("offset") + sb.append('=') + sb.append((if ((this.offset == null)) "" else this.offset)) + sb.append(',') + sb.append("length") + sb.append('=') + sb.append((if ((this.length == null)) "" else this.length)) + sb.append(',') + if (sb.charAt((sb.length - 1)) == ',') { + sb.setCharAt((sb.length - 1), ']') + } else { + sb.append(']') + } + sb.toString + } + + override def hashCode(): Int = { + var result = 1 + result = ((result * 31) + (if ((this.endLine == null)) 0 else this.endLine.hashCode)) + result = ((result * 31) + (if ((this.endColumn == null)) 0 else this.endColumn.hashCode)) + result = ((result * 31) + (if ((this.offset == null)) 0 else this.offset.hashCode)) + result = ((result * 31) + (if ((this.startColumn == null)) 0 else this.startColumn.hashCode)) + result = ((result * 31) + (if ((this.startLine == null)) 0 else this.startLine.hashCode)) + result = ((result * 31) + (if ((this.length == null)) 0 else this.length.hashCode)) + result + } + + override def equals(other: Any): Boolean = { + if (other == this) { + return true + } + if ((other.isInstanceOf[Region]) == false) { + return false + } + val rhs = other.asInstanceOf[Region] + (((((((this.endLine == rhs.endLine) || ((this.endLine != null) && this.endLine == rhs.endLine)) && ((this.endColumn == rhs.endColumn) || ((this.endColumn != null) && this.endColumn == rhs.endColumn))) && ((this.offset == rhs.offset) || ((this.offset != null) && this.offset == rhs.offset))) && ((this.startColumn == rhs.startColumn) || ((this.startColumn != null) && this.startColumn == rhs.startColumn))) && ((this.startLine == rhs.startLine) || ((this.startLine != null) && this.startLine == rhs.startLine))) && ((this.length == rhs.length) || ((this.length != null) && this.length == rhs.length))) + } +} diff --git a/schema/scala-gen/Replacement.scala b/schema/scala-gen/Replacement.scala new file mode 100644 index 0000000..8ddc5b3 --- /dev/null +++ b/schema/scala-gen/Replacement.scala @@ -0,0 +1,69 @@ +import com.fasterxml.jackson.annotation.JsonInclude +import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.annotation.JsonPropertyDescription +import com.fasterxml.jackson.annotation.JsonPropertyOrder +import scala.beans.{BeanProperty, BooleanBeanProperty} +//remove if not needed +import scala.collection.JavaConversions._ + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder(Array("offset", "deletedLength", "insertedBytes")) +class Replacement { + + @JsonProperty("offset") + @JsonPropertyDescription("A non-negative integer specifying the offset in bytes from the beginning of the file at which bytes are to be removed, inserted or both. An offset of 0 shall denote the first byte in the file.") + @BeanProperty + var offset: java.lang.Integer = _ + + @JsonProperty("deletedLength") + @JsonPropertyDescription("The number of bytes to delete, starting at the byte offset specified by offset, measured from the beginning of the file.") + @BeanProperty + var deletedLength: java.lang.Integer = _ + + @JsonProperty("insertedBytes") + @JsonPropertyDescription("The MIME Base64-encoded byte sequence to be inserted at the byte offset specified by the 'offset' property, measured from the beginning of the file.") + @BeanProperty + var insertedBytes: String = _ + + override def toString(): String = { + val sb = new StringBuilder() + sb.append(classOf[Replacement].getName).append('@').append(java.lang.Integer.toHexString(System.identityHashCode(this))).append('[') + sb.append("offset") + sb.append('=') + sb.append((if ((this.offset == null)) "" else this.offset)) + sb.append(',') + sb.append("deletedLength") + sb.append('=') + sb.append((if ((this.deletedLength == null)) "" else this.deletedLength)) + sb.append(',') + sb.append("insertedBytes") + sb.append('=') + sb.append((if ((this.insertedBytes == null)) "" else this.insertedBytes)) + sb.append(',') + if (sb.charAt((sb.length - 1)) == ',') { + sb.setCharAt((sb.length - 1), ']') + } else { + sb.append(']') + } + sb.toString + } + + override def hashCode(): Int = { + var result = 1 + result = ((result * 31) + (if ((this.deletedLength == null)) 0 else this.deletedLength.hashCode)) + result = ((result * 31) + (if ((this.offset == null)) 0 else this.offset.hashCode)) + result = ((result * 31) + (if ((this.insertedBytes == null)) 0 else this.insertedBytes.hashCode)) + result + } + + override def equals(other: Any): Boolean = { + if (other == this) { + return true + } + if ((other.isInstanceOf[Replacement]) == false) { + return false + } + val rhs = other.asInstanceOf[Replacement] + ((((this.deletedLength == rhs.deletedLength) || ((this.deletedLength != null) && this.deletedLength == rhs.deletedLength)) && ((this.offset == rhs.offset) || ((this.offset != null) && this.offset == rhs.offset))) && ((this.insertedBytes == rhs.insertedBytes) || ((this.insertedBytes != null) && this.insertedBytes == rhs.insertedBytes))) + } +} diff --git a/schema/scala-gen/ResponseFiles.scala b/schema/scala-gen/ResponseFiles.scala new file mode 100644 index 0000000..94146bc --- /dev/null +++ b/schema/scala-gen/ResponseFiles.scala @@ -0,0 +1,36 @@ +import com.fasterxml.jackson.annotation.JsonInclude +import com.fasterxml.jackson.annotation.JsonPropertyOrder +//remove if not needed +import scala.collection.JavaConversions._ + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder(Array()) +class ResponseFiles { + + override def toString(): String = { + val sb = new StringBuilder() + sb.append(classOf[ResponseFiles].getName).append('@').append(java.lang.Integer.toHexString(System.identityHashCode(this))).append('[') + if (sb.charAt((sb.length - 1)) == ',') { + sb.setCharAt((sb.length - 1), ']') + } else { + sb.append(']') + } + sb.toString + } + + override def hashCode(): Int = { + val result = 1 + result + } + + override def equals(other: Any): Boolean = { + if (other == this) { + return true + } + if ((other.isInstanceOf[ResponseFiles]) == false) { + return false + } + val rhs = other.asInstanceOf[ResponseFiles] + true + } +} diff --git a/schema/scala-gen/Result.scala b/schema/scala-gen/Result.scala new file mode 100644 index 0000000..0dbbe2a --- /dev/null +++ b/schema/scala-gen/Result.scala @@ -0,0 +1,284 @@ +import java.util.ArrayList +import java.util.HashMap +import java.util.LinkedHashSet +import java.util.List +import java.util.Map +import java.util.Set +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonInclude +import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.annotation.JsonPropertyDescription +import com.fasterxml.jackson.annotation.JsonPropertyOrder +import com.fasterxml.jackson.annotation.JsonValue +import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import Result._ +import scala.beans.{BeanProperty, BooleanBeanProperty} +//remove if not needed +import scala.collection.JavaConversions._ + +object Result { + + object BaselineState extends Enumeration { + + val NEW = new BaselineState("new") + + val EXISTING = new BaselineState("existing") + + val ABSENT = new BaselineState("absent") + + class BaselineState private (var value: String) extends Val { + + override def toString(): String = this.value + } + + private val CONSTANTS = new HashMap[String, Result.BaselineState]() + + for (c <- values) { + CONSTANTS.put(c.value, c) + } + + @JsonCreator + def fromValue(value: String): Result.BaselineState = { + val constant = CONSTANTS.get(value) + if (constant == null) { + throw new IllegalArgumentException(value) + } else { + constant + } + } + + implicit def convertValue(v: Value): BaselineState = v.asInstanceOf[BaselineState] + } + + object Level extends Enumeration { + + val NOT_APPLICABLE = new Level("notApplicable") + + val PASS = new Level("pass") + + val NOTE = new Level("note") + + val WARNING = new Level("warning") + + val ERROR = new Level("error") + + class Level private (var value: String) extends Val { + + override def toString(): String = this.value + } + + private val CONSTANTS = new HashMap[String, Result.Level]() + + for (c <- values) { + CONSTANTS.put(c.value, c) + } + + @JsonCreator + def fromValue(value: String): Result.Level = { + val constant = CONSTANTS.get(value) + if (constant == null) { + throw new IllegalArgumentException(value) + } else { + constant + } + } + + implicit def convertValue(v: Value): Level = v.asInstanceOf[Level] + } +} + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder(Array("ruleId", "ruleKey", "level", "message", "formattedRuleMessage", "locations", "snippet", "id", "toolFingerprintContribution", "stacks", "codeFlows", "relatedLocations", "suppressionStates", "baselineState", "fixes", "properties")) +class Result { + + @JsonProperty("ruleId") + @JsonPropertyDescription("The stable, unique identifier of the rule (if any) to which this notification is relevant. If 'ruleKey' is not specified, this member can be used to retrieve rule metadata from the rules dictionary, if it exists.") + @BeanProperty + var ruleId: String = _ + + @JsonProperty("ruleKey") + @JsonPropertyDescription("A key used to retrieve the rule metadata from the rules dictionary that is relevant to the notificationn.") + @BeanProperty + var ruleKey: String = _ + + @JsonProperty("level") + @JsonPropertyDescription("A value specifying the severity level of the result. If this property is not present, its implied value is 'warning'.") + @BeanProperty + var level: Result.Level = Result.Level.fromValue("warning") + + @JsonProperty("message") + @JsonPropertyDescription("A string that describes the result. The first sentence of the message only will be displayed when visible space is limited.") + @BeanProperty + var message: String = _ + + @JsonProperty("formattedRuleMessage") + @JsonPropertyDescription("Contains information that can be used to construct a formatted message that describes a result.") + @BeanProperty + var formattedRuleMessage: FormattedRuleMessage = _ + + @JsonProperty("locations") + @JsonDeserialize(as = classOf[java.util.LinkedHashSet]) + @JsonPropertyDescription("One or more locations where the result occurred. Specify only one location unless the problem indicated by the result can only be corrected by making a change at every specified location.") + @BeanProperty + var locations: Set[Location] = new LinkedHashSet[Location]() + + @JsonProperty("snippet") + @JsonPropertyDescription("A source code or other file fragment that illustrates the result.") + @BeanProperty + var snippet: String = _ + + @JsonProperty("id") + @JsonPropertyDescription("A unique identifer for the result.") + @BeanProperty + var id: String = _ + + @JsonProperty("toolFingerprintContribution") + @JsonPropertyDescription("A string that contributes to the unique identity of the result.") + @BeanProperty + var toolFingerprintContribution: String = _ + + @JsonProperty("stacks") + @JsonDeserialize(as = classOf[java.util.LinkedHashSet]) + @JsonPropertyDescription("An array of 'stack' objects relevant to the result.") + @BeanProperty + var stacks: Set[Stack] = new LinkedHashSet[Stack]() + + @JsonProperty("codeFlows") + @JsonDeserialize(as = classOf[java.util.LinkedHashSet]) + @JsonPropertyDescription("An array of 'codeFlow' objects relevant to the result.") + @BeanProperty + var codeFlows: Set[CodeFlow] = new LinkedHashSet[CodeFlow]() + + @JsonProperty("relatedLocations") + @JsonDeserialize(as = classOf[java.util.LinkedHashSet]) + @JsonPropertyDescription("A grouped set of locations and messages, if available, that represent code areas that are related to this result.") + @BeanProperty + var relatedLocations: Set[AnnotatedCodeLocation] = new LinkedHashSet[AnnotatedCodeLocation]() + + @JsonProperty("suppressionStates") + @BeanProperty + var suppressionStates: List[SuppressionState] = new ArrayList[SuppressionState]() + + @JsonProperty("baselineState") + @JsonPropertyDescription("The state of a result relative to a baseline of a previous run.") + @BeanProperty + var baselineState: Result.BaselineState = _ + + @JsonProperty("fixes") + @JsonDeserialize(as = classOf[java.util.LinkedHashSet]) + @JsonPropertyDescription("An array of 'fix' objects, each of which represents a proposed fix to the problem indicated by the result.") + @BeanProperty + var fixes: Set[Fix] = new LinkedHashSet[Fix]() + + @JsonProperty("properties") + @JsonPropertyDescription("Key/value pairs that provide additional information about the result.") + @BeanProperty + var properties: Properties__7 = _ + + override def toString(): String = { + val sb = new StringBuilder() + sb.append(classOf[Result].getName).append('@').append(java.lang.Integer.toHexString(System.identityHashCode(this))).append('[') + sb.append("ruleId") + sb.append('=') + sb.append((if ((this.ruleId == null)) "" else this.ruleId)) + sb.append(',') + sb.append("ruleKey") + sb.append('=') + sb.append((if ((this.ruleKey == null)) "" else this.ruleKey)) + sb.append(',') + sb.append("level") + sb.append('=') + sb.append((if ((this.level == null)) "" else this.level)) + sb.append(',') + sb.append("message") + sb.append('=') + sb.append((if ((this.message == null)) "" else this.message)) + sb.append(',') + sb.append("formattedRuleMessage") + sb.append('=') + sb.append((if ((this.formattedRuleMessage == null)) "" else this.formattedRuleMessage)) + sb.append(',') + sb.append("locations") + sb.append('=') + sb.append((if ((this.locations == null)) "" else this.locations)) + sb.append(',') + sb.append("snippet") + sb.append('=') + sb.append((if ((this.snippet == null)) "" else this.snippet)) + sb.append(',') + sb.append("id") + sb.append('=') + sb.append((if ((this.id == null)) "" else this.id)) + sb.append(',') + sb.append("toolFingerprintContribution") + sb.append('=') + sb.append((if ((this.toolFingerprintContribution == null)) "" else this.toolFingerprintContribution)) + sb.append(',') + sb.append("stacks") + sb.append('=') + sb.append((if ((this.stacks == null)) "" else this.stacks)) + sb.append(',') + sb.append("codeFlows") + sb.append('=') + sb.append((if ((this.codeFlows == null)) "" else this.codeFlows)) + sb.append(',') + sb.append("relatedLocations") + sb.append('=') + sb.append((if ((this.relatedLocations == null)) "" else this.relatedLocations)) + sb.append(',') + sb.append("suppressionStates") + sb.append('=') + sb.append((if ((this.suppressionStates == null)) "" else this.suppressionStates)) + sb.append(',') + sb.append("baselineState") + sb.append('=') + sb.append((if ((this.baselineState == null)) "" else this.baselineState)) + sb.append(',') + sb.append("fixes") + sb.append('=') + sb.append((if ((this.fixes == null)) "" else this.fixes)) + sb.append(',') + sb.append("properties") + sb.append('=') + sb.append((if ((this.properties == null)) "" else this.properties)) + sb.append(',') + if (sb.charAt((sb.length - 1)) == ',') { + sb.setCharAt((sb.length - 1), ']') + } else { + sb.append(']') + } + sb.toString + } + + override def hashCode(): Int = { + var result = 1 + result = ((result * 31) + (if ((this.snippet == null)) 0 else this.snippet.hashCode)) + result = ((result * 31) + (if ((this.toolFingerprintContribution == null)) 0 else this.toolFingerprintContribution.hashCode)) + result = ((result * 31) + (if ((this.level == null)) 0 else this.level.hashCode)) + result = ((result * 31) + (if ((this.stacks == null)) 0 else this.stacks.hashCode)) + result = ((result * 31) + (if ((this.suppressionStates == null)) 0 else this.suppressionStates.hashCode)) + result = ((result * 31) + (if ((this.message == null)) 0 else this.message.hashCode)) + result = ((result * 31) + (if ((this.ruleKey == null)) 0 else this.ruleKey.hashCode)) + result = ((result * 31) + (if ((this.fixes == null)) 0 else this.fixes.hashCode)) + result = ((result * 31) + (if ((this.relatedLocations == null)) 0 else this.relatedLocations.hashCode)) + result = ((result * 31) + (if ((this.codeFlows == null)) 0 else this.codeFlows.hashCode)) + result = ((result * 31) + (if ((this.formattedRuleMessage == null)) 0 else this.formattedRuleMessage.hashCode)) + result = ((result * 31) + (if ((this.locations == null)) 0 else this.locations.hashCode)) + result = ((result * 31) + (if ((this.id == null)) 0 else this.id.hashCode)) + result = ((result * 31) + (if ((this.baselineState == null)) 0 else this.baselineState.hashCode)) + result = ((result * 31) + (if ((this.ruleId == null)) 0 else this.ruleId.hashCode)) + result = ((result * 31) + (if ((this.properties == null)) 0 else this.properties.hashCode)) + result + } + + override def equals(other: Any): Boolean = { + if (other == this) { + return true + } + if ((other.isInstanceOf[Result]) == false) { + return false + } + val rhs = other.asInstanceOf[Result] + (((((((((((((((((this.snippet == rhs.snippet) || ((this.snippet != null) && this.snippet == rhs.snippet)) && ((this.toolFingerprintContribution == rhs.toolFingerprintContribution) || ((this.toolFingerprintContribution != null) && this.toolFingerprintContribution == rhs.toolFingerprintContribution))) && ((this.level == rhs.level) || ((this.level != null) && this.level == rhs.level))) && ((this.stacks == rhs.stacks) || ((this.stacks != null) && this.stacks == rhs.stacks))) && ((this.suppressionStates == rhs.suppressionStates) || ((this.suppressionStates != null) && this.suppressionStates == rhs.suppressionStates))) && ((this.message == rhs.message) || ((this.message != null) && this.message == rhs.message))) && ((this.ruleKey == rhs.ruleKey) || ((this.ruleKey != null) && this.ruleKey == rhs.ruleKey))) && ((this.fixes == rhs.fixes) || ((this.fixes != null) && this.fixes == rhs.fixes))) && ((this.relatedLocations == rhs.relatedLocations) || ((this.relatedLocations != null) && this.relatedLocations == rhs.relatedLocations))) && ((this.codeFlows == rhs.codeFlows) || ((this.codeFlows != null) && this.codeFlows == rhs.codeFlows))) && ((this.formattedRuleMessage == rhs.formattedRuleMessage) || ((this.formattedRuleMessage != null) && this.formattedRuleMessage == rhs.formattedRuleMessage))) && ((this.locations == rhs.locations) || ((this.locations != null) && this.locations == rhs.locations))) && ((this.id == rhs.id) || ((this.id != null) && this.id == rhs.id))) && ((this.baselineState == rhs.baselineState) || ((this.baselineState != null) && this.baselineState == rhs.baselineState))) && ((this.ruleId == rhs.ruleId) || ((this.ruleId != null) && this.ruleId == rhs.ruleId))) && ((this.properties == rhs.properties) || ((this.properties != null) && this.properties == rhs.properties))) + } +} diff --git a/schema/scala-gen/Rules.scala b/schema/scala-gen/Rules.scala new file mode 100644 index 0000000..c99cc2b --- /dev/null +++ b/schema/scala-gen/Rules.scala @@ -0,0 +1,36 @@ +import com.fasterxml.jackson.annotation.JsonInclude +import com.fasterxml.jackson.annotation.JsonPropertyOrder +//remove if not needed +import scala.collection.JavaConversions._ + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder(Array()) +class Rules { + + override def toString(): String = { + val sb = new StringBuilder() + sb.append(classOf[Rules].getName).append('@').append(java.lang.Integer.toHexString(System.identityHashCode(this))).append('[') + if (sb.charAt((sb.length - 1)) == ',') { + sb.setCharAt((sb.length - 1), ']') + } else { + sb.append(']') + } + sb.toString + } + + override def hashCode(): Int = { + val result = 1 + result + } + + override def equals(other: Any): Boolean = { + if (other == this) { + return true + } + if ((other.isInstanceOf[Rules]) == false) { + return false + } + val rhs = other.asInstanceOf[Rules] + true + } +} diff --git a/schema/scala-gen/Run.scala b/schema/scala-gen/Run.scala new file mode 100644 index 0000000..8db90dd --- /dev/null +++ b/schema/scala-gen/Run.scala @@ -0,0 +1,185 @@ +import java.util.ArrayList +import java.util.LinkedHashSet +import java.util.List +import java.util.Set +import com.fasterxml.jackson.annotation.JsonInclude +import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.annotation.JsonPropertyDescription +import com.fasterxml.jackson.annotation.JsonPropertyOrder +import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import scala.beans.{BeanProperty, BooleanBeanProperty} +//remove if not needed +import scala.collection.JavaConversions._ + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder(Array("tool", "invocation", "files", "logicalLocations", "results", "toolNotifications", "configurationNotifications", "rules", "id", "stableId", "automationId", "baselineId", "architecture", "properties")) +class Run { + + @JsonProperty("tool") + @JsonPropertyDescription("The analysis tool that was run.") + @BeanProperty + var tool: Tool = _ + + @JsonProperty("invocation") + @JsonPropertyDescription("The runtime environment of the analysis tool run.") + @BeanProperty + var invocation: Invocation = _ + + @JsonProperty("files") + @JsonPropertyDescription("A dictionary, each of whose keys is a URI and each of whose values is an array of file objects representing the location of a single file scanned during the run.") + @BeanProperty + var files: Files = _ + + @JsonProperty("logicalLocations") + @JsonPropertyDescription("A dictionary, each of whose keys specifies a logical location such as a namespace, type or function.") + @BeanProperty + var logicalLocations: LogicalLocations = _ + + @JsonProperty("results") + @JsonDeserialize(as = classOf[java.util.LinkedHashSet]) + @JsonPropertyDescription("The set of results contained in an SARIF log. The results array can be omitted when a run is solely exporting rules metadata. It must be present (but may be empty) in the event that a log file represents an actual scan.") + @BeanProperty + var results: Set[Result] = new LinkedHashSet[Result]() + + @JsonProperty("toolNotifications") + @JsonPropertyDescription("A list of runtime conditions detected by the tool in the course of the analysis.") + @BeanProperty + var toolNotifications: List[Notification] = new ArrayList[Notification]() + + @JsonProperty("configurationNotifications") + @JsonPropertyDescription("A list of conditions detected by the tool that are relevant to the tool's configuration.") + @BeanProperty + var configurationNotifications: List[Notification] = new ArrayList[Notification]() + + @JsonProperty("rules") + @JsonPropertyDescription("A dictionary, each of whose keys is a string and each of whose values is a 'rule' object, that describe all rules associated with an analysis tool or a specific run of an analysis tool.") + @BeanProperty + var rules: Rules = _ + + @JsonProperty("id") + @JsonPropertyDescription("An identifier for the run.") + @BeanProperty + var id: String = _ + + @JsonProperty("stableId") + @JsonPropertyDescription("A stable identifier for a run, for example, 'nightly Clang analyzer run'. Multiple runs of the same type can have the same stableId.") + @BeanProperty + var stableId: String = _ + + @JsonProperty("automationId") + @JsonPropertyDescription("A global identifier that allows the run to be correlated with other artifacts produced by a larger automation process.") + @BeanProperty + var automationId: String = _ + + @JsonProperty("baselineId") + @JsonPropertyDescription("The 'id' property of a separate (potentially external) SARIF 'run' instance that comprises the baseline that was used to compute result 'baselineState' properties for the run.") + @BeanProperty + var baselineId: String = _ + + @JsonProperty("architecture") + @JsonPropertyDescription("The hardware architecture for which the run was targeted.") + @BeanProperty + var architecture: String = _ + + @JsonProperty("properties") + @JsonPropertyDescription("Key/value pairs that provide additional information about the run.") + @BeanProperty + var properties: Properties__9 = _ + + override def toString(): String = { + val sb = new StringBuilder() + sb.append(classOf[Run].getName).append('@').append(java.lang.Integer.toHexString(System.identityHashCode(this))).append('[') + sb.append("tool") + sb.append('=') + sb.append((if ((this.tool == null)) "" else this.tool)) + sb.append(',') + sb.append("invocation") + sb.append('=') + sb.append((if ((this.invocation == null)) "" else this.invocation)) + sb.append(',') + sb.append("files") + sb.append('=') + sb.append((if ((this.files == null)) "" else this.files)) + sb.append(',') + sb.append("logicalLocations") + sb.append('=') + sb.append((if ((this.logicalLocations == null)) "" else this.logicalLocations)) + sb.append(',') + sb.append("results") + sb.append('=') + sb.append((if ((this.results == null)) "" else this.results)) + sb.append(',') + sb.append("toolNotifications") + sb.append('=') + sb.append((if ((this.toolNotifications == null)) "" else this.toolNotifications)) + sb.append(',') + sb.append("configurationNotifications") + sb.append('=') + sb.append((if ((this.configurationNotifications == null)) "" else this.configurationNotifications)) + sb.append(',') + sb.append("rules") + sb.append('=') + sb.append((if ((this.rules == null)) "" else this.rules)) + sb.append(',') + sb.append("id") + sb.append('=') + sb.append((if ((this.id == null)) "" else this.id)) + sb.append(',') + sb.append("stableId") + sb.append('=') + sb.append((if ((this.stableId == null)) "" else this.stableId)) + sb.append(',') + sb.append("automationId") + sb.append('=') + sb.append((if ((this.automationId == null)) "" else this.automationId)) + sb.append(',') + sb.append("baselineId") + sb.append('=') + sb.append((if ((this.baselineId == null)) "" else this.baselineId)) + sb.append(',') + sb.append("architecture") + sb.append('=') + sb.append((if ((this.architecture == null)) "" else this.architecture)) + sb.append(',') + sb.append("properties") + sb.append('=') + sb.append((if ((this.properties == null)) "" else this.properties)) + sb.append(',') + if (sb.charAt((sb.length - 1)) == ',') { + sb.setCharAt((sb.length - 1), ']') + } else { + sb.append(']') + } + sb.toString + } + + override def hashCode(): Int = { + var result = 1 + result = ((result * 31) + (if ((this.stableId == null)) 0 else this.stableId.hashCode)) + result = ((result * 31) + (if ((this.automationId == null)) 0 else this.automationId.hashCode)) + result = ((result * 31) + (if ((this.logicalLocations == null)) 0 else this.logicalLocations.hashCode)) + result = ((result * 31) + (if ((this.rules == null)) 0 else this.rules.hashCode)) + result = ((result * 31) + (if ((this.configurationNotifications == null)) 0 else this.configurationNotifications.hashCode)) + result = ((result * 31) + (if ((this.tool == null)) 0 else this.tool.hashCode)) + result = ((result * 31) + (if ((this.baselineId == null)) 0 else this.baselineId.hashCode)) + result = ((result * 31) + (if ((this.toolNotifications == null)) 0 else this.toolNotifications.hashCode)) + result = ((result * 31) + (if ((this.invocation == null)) 0 else this.invocation.hashCode)) + result = ((result * 31) + (if ((this.files == null)) 0 else this.files.hashCode)) + result = ((result * 31) + (if ((this.id == null)) 0 else this.id.hashCode)) + result = ((result * 31) + (if ((this.results == null)) 0 else this.results.hashCode)) + result = ((result * 31) + (if ((this.properties == null)) 0 else this.properties.hashCode)) + result = ((result * 31) + (if ((this.architecture == null)) 0 else this.architecture.hashCode)) + result + } + + override def equals(other: Any): Boolean = { + if (other == this) { + return true + } + if ((other.isInstanceOf[Run]) == false) { + return false + } + val rhs = other.asInstanceOf[Run] + (((((((((((((((this.stableId == rhs.stableId) || ((this.stableId != null) && this.stableId == rhs.stableId)) && ((this.automationId == rhs.automationId) || ((this.automationId != null) && this.automationId == rhs.automationId))) && ((this.logicalLocations == rhs.logicalLocations) || ((this.logicalLocations != null) && this.logicalLocations == rhs.logicalLocations))) && ((this.rules == rhs.rules) || ((this.rules != null) && this.rules == rhs.rules))) && ((this.configurationNotifications == rhs.configurationNotifications) || ((this.configurationNotifications != null) && this.configurationNotifications == rhs.configurationNotifications))) && ((this.tool == rhs.tool) || ((this.tool != null) && this.tool == rhs.tool))) && ((this.baselineId == rhs.baselineId) || ((this.baselineId != null) && this.baselineId == rhs.baselineId))) && ((this.toolNotifications == rhs.toolNotifications) || ((this.toolNotifications != null) && this.toolNotifications == rhs.toolNotifications))) && ((this.invocation == rhs.invocation) || ((this.invocation != null) && this.invocation == rhs.invocation))) && ((this.files == rhs.files) || ((this.files != null) && this.files == rhs.files))) && ((this.id == rhs.id) || ((this.id != null) && this.id == rhs.id))) && ((this.results == rhs.results) || ((this.results != null) && this.results == rhs.results))) && ((this.properties == rhs.properties) || ((this.properties != null) && this.properties == rhs.properties))) && ((this.architecture == rhs.architecture) || ((this.architecture != null) && this.architecture == rhs.architecture))) + } +} diff --git a/schema/scala-gen/Sarif100Schema.scala b/schema/scala-gen/Sarif100Schema.scala new file mode 100644 index 0000000..41c1e72 --- /dev/null +++ b/schema/scala-gen/Sarif100Schema.scala @@ -0,0 +1,115 @@ +import java.net.URI +import java.util.ArrayList +import java.util.HashMap +import java.util.List +import java.util.Map +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonInclude +import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.annotation.JsonPropertyDescription +import com.fasterxml.jackson.annotation.JsonPropertyOrder +import com.fasterxml.jackson.annotation.JsonValue +import Sarif100Schema._ +import scala.beans.{BeanProperty, BooleanBeanProperty} +//remove if not needed +import scala.collection.JavaConversions._ + +object Sarif100Schema { + + object Version extends Enumeration { + + val _1_0_0 = new Version("1.0.0") + + class Version private (var value: String) extends Val { + + override def toString(): String = this.value + } + + private val CONSTANTS = new HashMap[String, Sarif100Schema.Version]() + + for (c <- values) { + CONSTANTS.put(c.value, c) + } + + @JsonCreator + def fromValue(value: String): Sarif100Schema.Version = { + val constant = CONSTANTS.get(value) + if (constant == null) { + throw new IllegalArgumentException(value) + } else { + constant + } + } + + implicit def convertValue(v: Value): Version = v.asInstanceOf[Version] + } +} + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder(Array("$schema", "version", "runs")) +class Sarif100Schema { + + @JsonProperty("$schema") + @JsonPropertyDescription("The URI of the JSON schema corresponding to the version.") + private var $schema: URI = _ + + @JsonProperty("version") + @JsonPropertyDescription("The SARIF format version of this log file.") + @BeanProperty + var version: Sarif100Schema.Version = _ + + @JsonProperty("runs") + @JsonPropertyDescription("The set of runs contained in this log file.") + @BeanProperty + var runs: List[Run] = new ArrayList[Run]() + + @JsonProperty("$schema") + def get$schema(): URI = $schema + + @JsonProperty("$schema") + def set$schema($schema: URI) { + this.$schema = $schema + } + + override def toString(): String = { + val sb = new StringBuilder() + sb.append(classOf[Sarif100Schema].getName).append('@').append(java.lang.Integer.toHexString(System.identityHashCode(this))).append('[') + sb.append("$schema") + sb.append('=') + sb.append((if ((this.$schema == null)) "" else this.$schema)) + sb.append(',') + sb.append("version") + sb.append('=') + sb.append((if ((this.version == null)) "" else this.version)) + sb.append(',') + sb.append("runs") + sb.append('=') + sb.append((if ((this.runs == null)) "" else this.runs)) + sb.append(',') + if (sb.charAt((sb.length - 1)) == ',') { + sb.setCharAt((sb.length - 1), ']') + } else { + sb.append(']') + } + sb.toString + } + + override def hashCode(): Int = { + var result = 1 + result = ((result * 31) + (if ((this.$schema == null)) 0 else this.$schema.hashCode)) + result = ((result * 31) + (if ((this.version == null)) 0 else this.version.hashCode)) + result = ((result * 31) + (if ((this.runs == null)) 0 else this.runs.hashCode)) + result + } + + override def equals(other: Any): Boolean = { + if (other == this) { + return true + } + if ((other.isInstanceOf[Sarif100Schema]) == false) { + return false + } + val rhs = other.asInstanceOf[Sarif100Schema] + ((((this.$schema == rhs.$schema) || ((this.$schema != null) && this.$schema == rhs.$schema)) && ((this.version == rhs.version) || ((this.version != null) && this.version == rhs.version))) && ((this.runs == rhs.runs) || ((this.runs != null) && this.runs == rhs.runs))) + } +} diff --git a/schema/scala-gen/Stack.scala b/schema/scala-gen/Stack.scala new file mode 100644 index 0000000..b021b82 --- /dev/null +++ b/schema/scala-gen/Stack.scala @@ -0,0 +1,71 @@ +import java.util.ArrayList +import java.util.List +import com.fasterxml.jackson.annotation.JsonInclude +import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.annotation.JsonPropertyDescription +import com.fasterxml.jackson.annotation.JsonPropertyOrder +import scala.beans.{BeanProperty, BooleanBeanProperty} +//remove if not needed +import scala.collection.JavaConversions._ + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder(Array("message", "frames", "properties")) +class Stack { + + @JsonProperty("message") + @JsonPropertyDescription("A message relevant to this call stack.") + @BeanProperty + var message: String = _ + + @JsonProperty("frames") + @JsonPropertyDescription("An array of stack frames that represent a sequence of calls, rendered in reverse chronological order, that comprise the call stack.") + @BeanProperty + var frames: List[StackFrame] = new ArrayList[StackFrame]() + + @JsonProperty("properties") + @JsonPropertyDescription("Key/value pairs that provide additional information about the stack.") + @BeanProperty + var properties: Properties__4 = _ + + override def toString(): String = { + val sb = new StringBuilder() + sb.append(classOf[Stack].getName).append('@').append(java.lang.Integer.toHexString(System.identityHashCode(this))).append('[') + sb.append("message") + sb.append('=') + sb.append((if ((this.message == null)) "" else this.message)) + sb.append(',') + sb.append("frames") + sb.append('=') + sb.append((if ((this.frames == null)) "" else this.frames)) + sb.append(',') + sb.append("properties") + sb.append('=') + sb.append((if ((this.properties == null)) "" else this.properties)) + sb.append(',') + if (sb.charAt((sb.length - 1)) == ',') { + sb.setCharAt((sb.length - 1), ']') + } else { + sb.append(']') + } + sb.toString + } + + override def hashCode(): Int = { + var result = 1 + result = ((result * 31) + (if ((this.message == null)) 0 else this.message.hashCode)) + result = ((result * 31) + (if ((this.frames == null)) 0 else this.frames.hashCode)) + result = ((result * 31) + (if ((this.properties == null)) 0 else this.properties.hashCode)) + result + } + + override def equals(other: Any): Boolean = { + if (other == this) { + return true + } + if ((other.isInstanceOf[Stack]) == false) { + return false + } + val rhs = other.asInstanceOf[Stack] + ((((this.message == rhs.message) || ((this.message != null) && this.message == rhs.message)) && ((this.frames == rhs.frames) || ((this.frames != null) && this.frames == rhs.frames))) && ((this.properties == rhs.properties) || ((this.properties != null) && this.properties == rhs.properties))) + } +} diff --git a/schema/scala-gen/StackFrame.scala b/schema/scala-gen/StackFrame.scala new file mode 100644 index 0000000..f6d9b0e --- /dev/null +++ b/schema/scala-gen/StackFrame.scala @@ -0,0 +1,172 @@ +import java.net.URI +import java.util.ArrayList +import java.util.List +import com.fasterxml.jackson.annotation.JsonInclude +import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.annotation.JsonPropertyDescription +import com.fasterxml.jackson.annotation.JsonPropertyOrder +import scala.beans.{BeanProperty, BooleanBeanProperty} +//remove if not needed +import scala.collection.JavaConversions._ + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder(Array("message", "uri", "uriBaseId", "line", "column", "module", "threadId", "fullyQualifiedLogicalName", "logicalLocationKey", "address", "offset", "parameters", "properties")) +class StackFrame { + + @JsonProperty("message") + @JsonPropertyDescription("A message relevant to this stack frame.") + @BeanProperty + var message: String = _ + + @JsonProperty("uri") + @JsonPropertyDescription("The uri of the source code file to which this stack frame refers.") + @BeanProperty + var uri: URI = _ + + @JsonProperty("uriBaseId") + @JsonPropertyDescription("A string that identifies the conceptual base for the 'uri' property (if it is relative), e.g.,'$(SolutionDir)' or '%SRCROOT%'.") + @BeanProperty + var uriBaseId: String = _ + + @JsonProperty("line") + @JsonPropertyDescription("The line of the location to which this stack frame refers.") + @BeanProperty + var line: java.lang.Integer = _ + + @JsonProperty("column") + @JsonPropertyDescription("The line of the location to which this stack frame refers.") + @BeanProperty + var column: java.lang.Integer = _ + + @JsonProperty("module") + @JsonPropertyDescription("The name of the module that contains the code of this stack frame.") + @BeanProperty + var module: String = _ + + @JsonProperty("threadId") + @JsonPropertyDescription("The thread identifier of the stack frame.") + @BeanProperty + var threadId: java.lang.Integer = _ + + @JsonProperty("fullyQualifiedLogicalName") + @JsonPropertyDescription("The fully qualified name of the method or function that is executing.") + @BeanProperty + var fullyQualifiedLogicalName: String = _ + + @JsonProperty("logicalLocationKey") + @JsonPropertyDescription("A key used to retrieve the stack frame logicalLocation from the logicalLocations dictionary, when the 'fullyQualifiedLogicalName' is not unique.") + @BeanProperty + var logicalLocationKey: String = _ + + @JsonProperty("address") + @JsonPropertyDescription("The address of the method or function that is executing.") + @BeanProperty + var address: java.lang.Integer = _ + + @JsonProperty("offset") + @JsonPropertyDescription("The offset from the method or function that is executing.") + @BeanProperty + var offset: java.lang.Integer = _ + + @JsonProperty("parameters") + @JsonPropertyDescription("The parameters of the call that is executing.") + @BeanProperty + var parameters: List[String] = new ArrayList[String]() + + @JsonProperty("properties") + @JsonPropertyDescription("Key/value pairs that provide additional information about the stack frame.") + @BeanProperty + var properties: Properties__3 = _ + + override def toString(): String = { + val sb = new StringBuilder() + sb.append(classOf[StackFrame].getName).append('@').append(java.lang.Integer.toHexString(System.identityHashCode(this))).append('[') + sb.append("message") + sb.append('=') + sb.append((if ((this.message == null)) "" else this.message)) + sb.append(',') + sb.append("uri") + sb.append('=') + sb.append((if ((this.uri == null)) "" else this.uri)) + sb.append(',') + sb.append("uriBaseId") + sb.append('=') + sb.append((if ((this.uriBaseId == null)) "" else this.uriBaseId)) + sb.append(',') + sb.append("line") + sb.append('=') + sb.append((if ((this.line == null)) "" else this.line)) + sb.append(',') + sb.append("column") + sb.append('=') + sb.append((if ((this.column == null)) "" else this.column)) + sb.append(',') + sb.append("module") + sb.append('=') + sb.append((if ((this.module == null)) "" else this.module)) + sb.append(',') + sb.append("threadId") + sb.append('=') + sb.append((if ((this.threadId == null)) "" else this.threadId)) + sb.append(',') + sb.append("fullyQualifiedLogicalName") + sb.append('=') + sb.append((if ((this.fullyQualifiedLogicalName == null)) "" else this.fullyQualifiedLogicalName)) + sb.append(',') + sb.append("logicalLocationKey") + sb.append('=') + sb.append((if ((this.logicalLocationKey == null)) "" else this.logicalLocationKey)) + sb.append(',') + sb.append("address") + sb.append('=') + sb.append((if ((this.address == null)) "" else this.address)) + sb.append(',') + sb.append("offset") + sb.append('=') + sb.append((if ((this.offset == null)) "" else this.offset)) + sb.append(',') + sb.append("parameters") + sb.append('=') + sb.append((if ((this.parameters == null)) "" else this.parameters)) + sb.append(',') + sb.append("properties") + sb.append('=') + sb.append((if ((this.properties == null)) "" else this.properties)) + sb.append(',') + if (sb.charAt((sb.length - 1)) == ',') { + sb.setCharAt((sb.length - 1), ']') + } else { + sb.append(']') + } + sb.toString + } + + override def hashCode(): Int = { + var result = 1 + result = ((result * 31) + (if ((this.address == null)) 0 else this.address.hashCode)) + result = ((result * 31) + (if ((this.offset == null)) 0 else this.offset.hashCode)) + result = ((result * 31) + (if ((this.line == null)) 0 else this.line.hashCode)) + result = ((result * 31) + (if ((this.module == null)) 0 else this.module.hashCode)) + result = ((result * 31) + (if ((this.column == null)) 0 else this.column.hashCode)) + result = ((result * 31) + (if ((this.message == null)) 0 else this.message.hashCode)) + result = ((result * 31) + (if ((this.uri == null)) 0 else this.uri.hashCode)) + result = ((result * 31) + (if ((this.threadId == null)) 0 else this.threadId.hashCode)) + result = ((result * 31) + (if ((this.fullyQualifiedLogicalName == null)) 0 else this.fullyQualifiedLogicalName.hashCode)) + result = ((result * 31) + (if ((this.logicalLocationKey == null)) 0 else this.logicalLocationKey.hashCode)) + result = ((result * 31) + (if ((this.parameters == null)) 0 else this.parameters.hashCode)) + result = ((result * 31) + (if ((this.properties == null)) 0 else this.properties.hashCode)) + result = ((result * 31) + (if ((this.uriBaseId == null)) 0 else this.uriBaseId.hashCode)) + result + } + + override def equals(other: Any): Boolean = { + if (other == this) { + return true + } + if ((other.isInstanceOf[StackFrame]) == false) { + return false + } + val rhs = other.asInstanceOf[StackFrame] + ((((((((((((((this.address == rhs.address) || ((this.address != null) && this.address == rhs.address)) && ((this.offset == rhs.offset) || ((this.offset != null) && this.offset == rhs.offset))) && ((this.line == rhs.line) || ((this.line != null) && this.line == rhs.line))) && ((this.module == rhs.module) || ((this.module != null) && this.module == rhs.module))) && ((this.column == rhs.column) || ((this.column != null) && this.column == rhs.column))) && ((this.message == rhs.message) || ((this.message != null) && this.message == rhs.message))) && ((this.uri == rhs.uri) || ((this.uri != null) && this.uri == rhs.uri))) && ((this.threadId == rhs.threadId) || ((this.threadId != null) && this.threadId == rhs.threadId))) && ((this.fullyQualifiedLogicalName == rhs.fullyQualifiedLogicalName) || ((this.fullyQualifiedLogicalName != null) && this.fullyQualifiedLogicalName == rhs.fullyQualifiedLogicalName))) && ((this.logicalLocationKey == rhs.logicalLocationKey) || ((this.logicalLocationKey != null) && this.logicalLocationKey == rhs.logicalLocationKey))) && ((this.parameters == rhs.parameters) || ((this.parameters != null) && this.parameters == rhs.parameters))) && ((this.properties == rhs.properties) || ((this.properties != null) && this.properties == rhs.properties))) && ((this.uriBaseId == rhs.uriBaseId) || ((this.uriBaseId != null) && this.uriBaseId == rhs.uriBaseId))) + } +} diff --git a/schema/scala-gen/State.scala b/schema/scala-gen/State.scala new file mode 100644 index 0000000..6eee3fc --- /dev/null +++ b/schema/scala-gen/State.scala @@ -0,0 +1,36 @@ +import com.fasterxml.jackson.annotation.JsonInclude +import com.fasterxml.jackson.annotation.JsonPropertyOrder +//remove if not needed +import scala.collection.JavaConversions._ + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder(Array()) +class State { + + override def toString(): String = { + val sb = new StringBuilder() + sb.append(classOf[State].getName).append('@').append(java.lang.Integer.toHexString(System.identityHashCode(this))).append('[') + if (sb.charAt((sb.length - 1)) == ',') { + sb.setCharAt((sb.length - 1), ']') + } else { + sb.append(']') + } + sb.toString + } + + override def hashCode(): Int = { + val result = 1 + result + } + + override def equals(other: Any): Boolean = { + if (other == this) { + return true + } + if ((other.isInstanceOf[State]) == false) { + return false + } + val rhs = other.asInstanceOf[State] + true + } +} diff --git a/schema/scala-gen/SuppressionState.scala b/schema/scala-gen/SuppressionState.scala new file mode 100644 index 0000000..2bbf71c --- /dev/null +++ b/schema/scala-gen/SuppressionState.scala @@ -0,0 +1,36 @@ +import java.util.HashMap +import java.util.Map +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonValue +//remove if not needed +import scala.collection.JavaConversions._ + +object SuppressionState extends Enumeration { + + val SUPPRESSED_IN_SOURCE = new SuppressionState("suppressedInSource") + + val SUPPRESSED_EXTERNALLY = new SuppressionState("suppressedExternally") + + class SuppressionState private (var value: String) extends Val { + + override def toString(): String = this.value + } + + private val CONSTANTS = new HashMap[String, SuppressionState]() + + for (c <- values) { + CONSTANTS.put(c.value, c) + } + + @JsonCreator + def fromValue(value: String): SuppressionState = { + val constant = CONSTANTS.get(value) + if (constant == null) { + throw new IllegalArgumentException(value) + } else { + constant + } + } + + implicit def convertValue(v: Value): SuppressionState = v.asInstanceOf[SuppressionState] +} diff --git a/schema/scala-gen/Tool.scala b/schema/scala-gen/Tool.scala new file mode 100644 index 0000000..cdfd6fa --- /dev/null +++ b/schema/scala-gen/Tool.scala @@ -0,0 +1,119 @@ +import com.fasterxml.jackson.annotation.JsonInclude +import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.annotation.JsonPropertyDescription +import com.fasterxml.jackson.annotation.JsonPropertyOrder +import scala.beans.{BeanProperty, BooleanBeanProperty} +//remove if not needed +import scala.collection.JavaConversions._ + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder(Array("name", "fullName", "version", "semanticVersion", "fileVersion", "sarifLoggerVersion", "language", "properties")) +class Tool { + + @JsonProperty("name") + @JsonPropertyDescription("The name of the tool.") + @BeanProperty + var name: String = _ + + @JsonProperty("fullName") + @JsonPropertyDescription("The name of the tool along with its version and any other useful identifying information, such as its locale.") + @BeanProperty + var fullName: String = _ + + @JsonProperty("version") + @JsonPropertyDescription("The tool version, in whatever format the tool natively provides.") + @BeanProperty + var version: String = _ + + @JsonProperty("semanticVersion") + @JsonPropertyDescription("The tool version in the format specified by Semantic Versioning 2.0.") + @BeanProperty + var semanticVersion: String = _ + + @JsonProperty("fileVersion") + @JsonPropertyDescription("The binary version of the tool's primary executable file (for operating systems such as Windows that provide that information).") + @BeanProperty + var fileVersion: String = _ + + @JsonProperty("sarifLoggerVersion") + @JsonPropertyDescription("A version that uniquely identifies the SARIF logging component that generated this file, if it is versioned separately from the tool.") + @BeanProperty + var sarifLoggerVersion: String = _ + + @JsonProperty("language") + @JsonPropertyDescription("The tool language (expressed as an ISO 649 two-letter lowercase culture code) and region (expressed as an ISO 3166 two-letter uppercase subculture code associated with a country or region).") + @BeanProperty + var language: String = _ + + @JsonProperty("properties") + @JsonPropertyDescription("Key/value pairs that provide additional information about the tool.") + @BeanProperty + var properties: Properties = _ + + override def toString(): String = { + val sb = new StringBuilder() + sb.append(classOf[Tool].getName).append('@').append(java.lang.Integer.toHexString(System.identityHashCode(this))).append('[') + sb.append("name") + sb.append('=') + sb.append((if ((this.name == null)) "" else this.name)) + sb.append(',') + sb.append("fullName") + sb.append('=') + sb.append((if ((this.fullName == null)) "" else this.fullName)) + sb.append(',') + sb.append("version") + sb.append('=') + sb.append((if ((this.version == null)) "" else this.version)) + sb.append(',') + sb.append("semanticVersion") + sb.append('=') + sb.append((if ((this.semanticVersion == null)) "" else this.semanticVersion)) + sb.append(',') + sb.append("fileVersion") + sb.append('=') + sb.append((if ((this.fileVersion == null)) "" else this.fileVersion)) + sb.append(',') + sb.append("sarifLoggerVersion") + sb.append('=') + sb.append((if ((this.sarifLoggerVersion == null)) "" else this.sarifLoggerVersion)) + sb.append(',') + sb.append("language") + sb.append('=') + sb.append((if ((this.language == null)) "" else this.language)) + sb.append(',') + sb.append("properties") + sb.append('=') + sb.append((if ((this.properties == null)) "" else this.properties)) + sb.append(',') + if (sb.charAt((sb.length - 1)) == ',') { + sb.setCharAt((sb.length - 1), ']') + } else { + sb.append(']') + } + sb.toString + } + + override def hashCode(): Int = { + var result = 1 + result = ((result * 31) + (if ((this.sarifLoggerVersion == null)) 0 else this.sarifLoggerVersion.hashCode)) + result = ((result * 31) + (if ((this.name == null)) 0 else this.name.hashCode)) + result = ((result * 31) + (if ((this.semanticVersion == null)) 0 else this.semanticVersion.hashCode)) + result = ((result * 31) + (if ((this.fullName == null)) 0 else this.fullName.hashCode)) + result = ((result * 31) + (if ((this.language == null)) 0 else this.language.hashCode)) + result = ((result * 31) + (if ((this.version == null)) 0 else this.version.hashCode)) + result = ((result * 31) + (if ((this.fileVersion == null)) 0 else this.fileVersion.hashCode)) + result = ((result * 31) + (if ((this.properties == null)) 0 else this.properties.hashCode)) + result + } + + override def equals(other: Any): Boolean = { + if (other == this) { + return true + } + if ((other.isInstanceOf[Tool]) == false) { + return false + } + val rhs = other.asInstanceOf[Tool] + (((((((((this.sarifLoggerVersion == rhs.sarifLoggerVersion) || ((this.sarifLoggerVersion != null) && this.sarifLoggerVersion == rhs.sarifLoggerVersion)) && ((this.name == rhs.name) || ((this.name != null) && this.name == rhs.name))) && ((this.semanticVersion == rhs.semanticVersion) || ((this.semanticVersion != null) && this.semanticVersion == rhs.semanticVersion))) && ((this.fullName == rhs.fullName) || ((this.fullName != null) && this.fullName == rhs.fullName))) && ((this.language == rhs.language) || ((this.language != null) && this.language == rhs.language))) && ((this.version == rhs.version) || ((this.version != null) && this.version == rhs.version))) && ((this.fileVersion == rhs.fileVersion) || ((this.fileVersion != null) && this.fileVersion == rhs.fileVersion))) && ((this.properties == rhs.properties) || ((this.properties != null) && this.properties == rhs.properties))) + } +}