# ViolatingConstructJson

A construct that violated a policy rule.

- Source: [`lib/cloud-assembly/validation-report-schema.ts`](https://github.com/aws/aws-cdk-cli/blob/HEAD/packages/@aws-cdk/cloud-assembly-schema/lib/cloud-assembly/validation-report-schema.ts)
- Type last changed: v2.258.0 · 4 Jun 2026

## Example

TypeScript:

```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { cloud_assembly_schema } from 'aws-cdk-lib';
const violatingConstructJson: cloud_assembly_schema.ViolatingConstructJson = {
  constructPath: 'constructPath',

  // the properties below are optional
  cloudFormationResource: {
    logicalId: 'logicalId',
    templatePath: 'templatePath',

    // the properties below are optional
    propertyPaths: ['propertyPaths'],
  },
  constructFqn: 'constructFqn',
  libraryVersion: 'libraryVersion',
  stackTraces: ['stackTraces'],
};
```

Python:

```python
from aws_cdk.cloud_assembly_schema import ViolatingConstructJson, CloudFormationResourceJson
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import cloud_assembly_schema

violating_construct_json = ViolatingConstructJson(
    construct_path="constructPath",

    # the properties below are optional
    cloud_formation_resource=CloudFormationResourceJson(
        logical_id="logicalId",
        template_path="templatePath",

        # the properties below are optional
        property_paths=["propertyPaths"]
    ),
    construct_fqn="constructFqn",
    library_version="libraryVersion",
    stack_traces=["stackTraces"]
)
```

Java:

```java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.cloud_assembly_schema.*;

ViolatingConstructJson violatingConstructJson = ViolatingConstructJson.builder()
        .constructPath("constructPath")

        // the properties below are optional
        .cloudFormationResource(CloudFormationResourceJson.builder()
                .logicalId("logicalId")
                .templatePath("templatePath")

                // the properties below are optional
                .propertyPaths(List.of("propertyPaths"))
                .build())
        .constructFqn("constructFqn")
        .libraryVersion("libraryVersion")
        .stackTraces(List.of("stackTraces"))
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.Cloud_assembly_schema;

var violatingConstructJson = new ViolatingConstructJson {
    ConstructPath = "constructPath",

    // the properties below are optional
    CloudFormationResource = new CloudFormationResourceJson {
        LogicalId = "logicalId",
        TemplatePath = "templatePath",

        // the properties below are optional
        PropertyPaths = new [] { "propertyPaths" }
    },
    ConstructFqn = "constructFqn",
    LibraryVersion = "libraryVersion",
    StackTraces = new [] { "stackTraces" }
};
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

violatingConstructJson := &ViolatingConstructJson{
	ConstructPath: jsii.String("constructPath"),

	// the properties below are optional
	CloudFormationResource: &CloudFormationResourceJson{
		LogicalId: jsii.String("logicalId"),
		TemplatePath: jsii.String("templatePath"),

		// the properties below are optional
		PropertyPaths: []*string{
			jsii.String("propertyPaths"),
		},
	},
	ConstructFqn: jsii.String("constructFqn"),
	LibraryVersion: jsii.String("libraryVersion"),
	StackTraces: []*string{
		jsii.String("stackTraces"),
	},
}
```

## Properties

- `cloudFormationResource`: [CloudFormationResourceJson](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.cloud_assembly_schema.CloudFormationResourceJson.html) — If this construct violation regards a CloudFormation resource, a reference to the resource details.

- `constructFqn`: string — The fully qualified name of the construct class (includes the library name).

  **Default:** no construct info

- `constructPath`: string (required) — The construct path as defined in the application.

  **Default:** no construct path

- `libraryVersion`: string — The version of the library that contains this construct.

  **Default:** no version info

  The library name is the first component of the construct FQN.

- `stackTraces`: string[] — Stack traces associated with this violation.

  **Default:** No stack traces

  This can be all the stack traces where a violating property got its value,
  or just the construct creation stack trace.

  Every element of the array is a stack trace, where each stack trace is a `\n`-delimited string.
