diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 9bc4bd3a2cf5..6b7d331fc43d 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -29346,6 +29346,62 @@ components: - service - started_at type: object + DORADeploymentPatchByVersionRequest: + description: Request to patch a DORA deployment event identified by service, environment, and version. + example: + data: + attributes: + change_failure: true + env: "production" + remediation: + type: "rollback" + service: "my-service" + version: "v1.2.3" + type: "dora_deployment_patch_request" + properties: + data: + $ref: "#/components/schemas/DORADeploymentPatchByVersionRequestData" + required: + - data + type: object + DORADeploymentPatchByVersionRequestAttributes: + description: Attributes for patching a DORA deployment event identified by service, environment, and version. + properties: + change_failure: + description: Indicates whether the deployment resulted in a change failure. + example: true + type: boolean + env: + description: The environment the deployment was performed in. + example: production + type: string + remediation: + $ref: "#/components/schemas/DORADeploymentPatchRemediation" + service: + description: The name of the service that was deployed. + example: my-service + type: string + version: + description: "The version deployed. This is the same version used to correlate with [APM Deployment Tracking](https://docs.datadoghq.com/tracing/services/deployment_tracking/)." + example: v1.2.3 + type: string + required: + - service + - env + - version + - change_failure + type: object + DORADeploymentPatchByVersionRequestData: + description: The JSON:API data for patching a deployment identified by service, environment, and version. + properties: + attributes: + $ref: "#/components/schemas/DORADeploymentPatchByVersionRequestAttributes" + type: + $ref: "#/components/schemas/DORADeploymentPatchRequestDataType" + required: + - type + - attributes + type: object DORADeploymentPatchRemediation: description: Remediation details for the deployment. Optional, but required to calculate failed deployment recovery time. properties: @@ -139542,6 +139598,52 @@ paths: permissions: - dora_metrics_write /api/v2/dora/deployments: + patch: + description: |- + Update a deployment's change failure status, identifying the deployment by its service, environment, and version instead of its ID. Use this to mark a deployment as a change failure or back to stable. You can optionally include remediation details to enable failed deployment recovery time calculation. If multiple deployments match the given service, environment, and version, the most recently finished one is updated. + operationId: PatchDORADeploymentByVersion + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + change_failure: true + env: production + service: my-service + version: v1.2.3 + type: dora_deployment_patch_request + schema: + $ref: "#/components/schemas/DORADeploymentPatchByVersionRequest" + required: true + responses: + "202": + description: Accepted + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "403": + $ref: "#/components/responses/NotAuthorizedResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Patch a deployment event by version + tags: ["DORA Metrics"] + x-codegen-request-body-name: body + x-permission: + operator: OR + permissions: + - dora_metrics_write + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). post: description: |- Use this API endpoint to get a list of deployment events. diff --git a/examples/v2/dora-metrics/PatchDORADeploymentByVersion.rb b/examples/v2/dora-metrics/PatchDORADeploymentByVersion.rb new file mode 100644 index 000000000000..5f28d598f2d7 --- /dev/null +++ b/examples/v2/dora-metrics/PatchDORADeploymentByVersion.rb @@ -0,0 +1,23 @@ +# Patch a deployment event by version returns "Accepted" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.patch_dora_deployment_by_version".to_sym] = true +end +api_instance = DatadogAPIClient::V2::DORAMetricsAPI.new + +body = DatadogAPIClient::V2::DORADeploymentPatchByVersionRequest.new({ + data: DatadogAPIClient::V2::DORADeploymentPatchByVersionRequestData.new({ + attributes: DatadogAPIClient::V2::DORADeploymentPatchByVersionRequestAttributes.new({ + change_failure: true, + env: "production", + remediation: DatadogAPIClient::V2::DORADeploymentPatchRemediation.new({ + type: DatadogAPIClient::V2::DORADeploymentPatchRemediationType::ROLLBACK, + }), + service: "my-service", + version: "v1.2.3", + }), + type: DatadogAPIClient::V2::DORADeploymentPatchRequestDataType::DORA_DEPLOYMENT_PATCH_REQUEST, + }), +}) +p api_instance.patch_dora_deployment_by_version(body) diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index c4bfa9ae1080..0876db4ab40b 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -3219,6 +3219,9 @@ "v2.DeleteDORADeployment" => { "deployment_id" => "String", }, + "v2.PatchDORADeploymentByVersion" => { + "body" => "DORADeploymentPatchByVersionRequest", + }, "v2.ListDORADeployments" => { "body" => "DORAListDeploymentsRequest", }, diff --git a/features/v2/dora_metrics.feature b/features/v2/dora_metrics.feature index d0dc8943ad91..4308920ca0ae 100644 --- a/features/v2/dora_metrics.feature +++ b/features/v2/dora_metrics.feature @@ -148,6 +148,24 @@ Feature: DORA Metrics When the request is sent Then the response status is 200 OK + @generated @skip @team:DataDog/ci-app-backend + Scenario: Patch a deployment event by version returns "Accepted" response + Given a valid "appKeyAuth" key in the system + And operation "PatchDORADeploymentByVersion" enabled + And new "PatchDORADeploymentByVersion" request + And body with value {"data": {"attributes": {"change_failure": true, "env": "production", "remediation": {"type": "rollback"}, "service": "my-service", "version": "v1.2.3"}, "type": "dora_deployment_patch_request"}} + When the request is sent + Then the response status is 202 Accepted + + @generated @skip @team:DataDog/ci-app-backend + Scenario: Patch a deployment event by version returns "Bad Request" response + Given a valid "appKeyAuth" key in the system + And operation "PatchDORADeploymentByVersion" enabled + And new "PatchDORADeploymentByVersion" request + And body with value {"data": {"attributes": {"change_failure": true, "env": "production", "remediation": {"type": "rollback"}, "service": "my-service", "version": "v1.2.3"}, "type": "dora_deployment_patch_request"}} + When the request is sent + Then the response status is 400 Bad Request + @generated @skip @team:DataDog/ci-app-backend Scenario: Patch a deployment event returns "Accepted" response Given a valid "appKeyAuth" key in the system diff --git a/features/v2/undo.json b/features/v2/undo.json index 133ab9ade47d..c2e3d7589990 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -2374,6 +2374,12 @@ "type": "idempotent" } }, + "PatchDORADeploymentByVersion": { + "tag": "DORA Metrics", + "undo": { + "type": "idempotent" + } + }, "ListDORADeployments": { "tag": "DORA Metrics", "undo": { diff --git a/lib/datadog_api_client/configuration.rb b/lib/datadog_api_client/configuration.rb index 5a416e62be64..cf19ba316abf 100644 --- a/lib/datadog_api_client/configuration.rb +++ b/lib/datadog_api_client/configuration.rb @@ -437,6 +437,7 @@ def initialize "v2.trigger_deployment_gates_evaluation": false, "v2.update_deployment_gate": false, "v2.update_deployment_rule": false, + "v2.patch_dora_deployment_by_version": false, "v2.clone_form": false, "v2.create_and_publish_form": false, "v2.create_form": false, diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 1bc8cbc8c62f..a6d8c93a72c2 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -2989,6 +2989,9 @@ def overrides "v2.dora_deployment_fetch_response" => "DORADeploymentFetchResponse", "v2.dora_deployment_object" => "DORADeploymentObject", "v2.dora_deployment_object_attributes" => "DORADeploymentObjectAttributes", + "v2.dora_deployment_patch_by_version_request" => "DORADeploymentPatchByVersionRequest", + "v2.dora_deployment_patch_by_version_request_attributes" => "DORADeploymentPatchByVersionRequestAttributes", + "v2.dora_deployment_patch_by_version_request_data" => "DORADeploymentPatchByVersionRequestData", "v2.dora_deployment_patch_remediation" => "DORADeploymentPatchRemediation", "v2.dora_deployment_patch_remediation_type" => "DORADeploymentPatchRemediationType", "v2.dora_deployment_patch_request" => "DORADeploymentPatchRequest", diff --git a/lib/datadog_api_client/v2/api/dora_metrics_api.rb b/lib/datadog_api_client/v2/api/dora_metrics_api.rb index a247f68f7cbe..b34cb815f279 100644 --- a/lib/datadog_api_client/v2/api/dora_metrics_api.rb +++ b/lib/datadog_api_client/v2/api/dora_metrics_api.rb @@ -703,5 +703,78 @@ def patch_dora_deployment_with_http_info(deployment_id, body, opts = {}) end return data, status_code, headers end + + # Patch a deployment event by version. + # + # @see #patch_dora_deployment_by_version_with_http_info + def patch_dora_deployment_by_version(body, opts = {}) + patch_dora_deployment_by_version_with_http_info(body, opts) + nil + end + + # Patch a deployment event by version. + # + # Update a deployment's change failure status, identifying the deployment by its service, environment, and version instead of its ID. Use this to mark a deployment as a change failure or back to stable. You can optionally include remediation details to enable failed deployment recovery time calculation. If multiple deployments match the given service, environment, and version, the most recently finished one is updated. + # + # @param body [DORADeploymentPatchByVersionRequest] + # @param opts [Hash] the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def patch_dora_deployment_by_version_with_http_info(body, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.patch_dora_deployment_by_version".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.patch_dora_deployment_by_version") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.patch_dora_deployment_by_version")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DORAMetricsAPI.patch_dora_deployment_by_version ...' + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling DORAMetricsAPI.patch_dora_deployment_by_version" + end + # resource path + local_var_path = '/api/v2/dora/deployments' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['*/*']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :patch_dora_deployment_by_version, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Patch, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DORAMetricsAPI#patch_dora_deployment_by_version\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end end end diff --git a/lib/datadog_api_client/v2/models/dora_deployment_patch_by_version_request.rb b/lib/datadog_api_client/v2/models/dora_deployment_patch_by_version_request.rb new file mode 100644 index 000000000000..e36051e15a7e --- /dev/null +++ b/lib/datadog_api_client/v2/models/dora_deployment_patch_by_version_request.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Request to patch a DORA deployment event identified by service, environment, and version. + class DORADeploymentPatchByVersionRequest + include BaseGenericModel + + # The JSON:API data for patching a deployment identified by service, environment, and version. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'DORADeploymentPatchByVersionRequestData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::DORADeploymentPatchByVersionRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/dora_deployment_patch_by_version_request_attributes.rb b/lib/datadog_api_client/v2/models/dora_deployment_patch_by_version_request_attributes.rb new file mode 100644 index 000000000000..955e170b33f7 --- /dev/null +++ b/lib/datadog_api_client/v2/models/dora_deployment_patch_by_version_request_attributes.rb @@ -0,0 +1,196 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Attributes for patching a DORA deployment event identified by service, environment, and version. + class DORADeploymentPatchByVersionRequestAttributes + include BaseGenericModel + + # Indicates whether the deployment resulted in a change failure. + attr_reader :change_failure + + # The environment the deployment was performed in. + attr_reader :env + + # Remediation details for the deployment. Optional, but required to calculate failed deployment recovery time. + attr_accessor :remediation + + # The name of the service that was deployed. + attr_reader :service + + # The version deployed. This is the same version used to correlate with [APM Deployment Tracking](https://docs.datadoghq.com/tracing/services/deployment_tracking/). + attr_reader :version + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'change_failure' => :'change_failure', + :'env' => :'env', + :'remediation' => :'remediation', + :'service' => :'service', + :'version' => :'version' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'change_failure' => :'Boolean', + :'env' => :'String', + :'remediation' => :'DORADeploymentPatchRemediation', + :'service' => :'String', + :'version' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::DORADeploymentPatchByVersionRequestAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'change_failure') + self.change_failure = attributes[:'change_failure'] + end + + if attributes.key?(:'env') + self.env = attributes[:'env'] + end + + if attributes.key?(:'remediation') + self.remediation = attributes[:'remediation'] + end + + if attributes.key?(:'service') + self.service = attributes[:'service'] + end + + if attributes.key?(:'version') + self.version = attributes[:'version'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @change_failure.nil? + return false if @env.nil? + return false if @service.nil? + return false if @version.nil? + true + end + + # Custom attribute writer method with validation + # @param change_failure [Object] Object to be assigned + # @!visibility private + def change_failure=(change_failure) + if change_failure.nil? + fail ArgumentError, 'invalid value for "change_failure", change_failure cannot be nil.' + end + @change_failure = change_failure + end + + # Custom attribute writer method with validation + # @param env [Object] Object to be assigned + # @!visibility private + def env=(env) + if env.nil? + fail ArgumentError, 'invalid value for "env", env cannot be nil.' + end + @env = env + end + + # Custom attribute writer method with validation + # @param service [Object] Object to be assigned + # @!visibility private + def service=(service) + if service.nil? + fail ArgumentError, 'invalid value for "service", service cannot be nil.' + end + @service = service + end + + # Custom attribute writer method with validation + # @param version [Object] Object to be assigned + # @!visibility private + def version=(version) + if version.nil? + fail ArgumentError, 'invalid value for "version", version cannot be nil.' + end + @version = version + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + change_failure == o.change_failure && + env == o.env && + remediation == o.remediation && + service == o.service && + version == o.version && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [change_failure, env, remediation, service, version, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/dora_deployment_patch_by_version_request_data.rb b/lib/datadog_api_client/v2/models/dora_deployment_patch_by_version_request_data.rb new file mode 100644 index 000000000000..9f4a6b243701 --- /dev/null +++ b/lib/datadog_api_client/v2/models/dora_deployment_patch_by_version_request_data.rb @@ -0,0 +1,144 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The JSON:API data for patching a deployment identified by service, environment, and version. + class DORADeploymentPatchByVersionRequestData + include BaseGenericModel + + # Attributes for patching a DORA deployment event identified by service, environment, and version. + attr_reader :attributes + + # JSON:API type for DORA deployment patch request. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'DORADeploymentPatchByVersionRequestAttributes', + :'type' => :'DORADeploymentPatchRequestDataType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::DORADeploymentPatchByVersionRequestData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, type, additional_properties].hash + end + end +end