Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions packages/aws-cdk-lib/aws-apigateway/lib/restapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { ArnFormat, CfnOutput, IResource as IResourceBase, Resource, Stack, Toke
import { ValidationError } from '../../core/lib/errors';
import { addConstructMetadata, MethodMetadata } from '../../core/lib/metadata-resource';
import { propertyInjectable } from '../../core/lib/prop-injectable';
import { applyInjectors } from '../../core/lib/prop-injectors-helpers';
import { APIGATEWAY_DISABLE_CLOUDWATCH_ROLE } from '../../cx-api';

const RESTAPI_SYMBOL = Symbol.for('@aws-cdk/aws-apigateway.RestApiBase');
Expand Down Expand Up @@ -1140,6 +1141,7 @@ export enum RestApiMode {
}

class RootResource extends ResourceBase {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Do we need to also add the @propertyInjectable decorator above the class just like we do for other constructs?
  2. [Minor] To be consistent, we should include the below comment above the PROPERTY_INJECTION_ID declaration:
/**
 * Uniquely identifies this class.
 */

public static readonly PROPERTY_INJECTION_ID: string = 'aws-cdk-lib.aws-apigateway.RootResource';
public readonly parentResource?: IResource;
public readonly api: RestApiBase;
public readonly resourceId: string;
Expand All @@ -1152,6 +1154,10 @@ class RootResource extends ResourceBase {

constructor(api: RestApiBase, props: ResourceOptions, resourceId: string) {
super(api, 'Default');
props = applyInjectors(RootResource.PROPERTY_INJECTION_ID, props, {
scope: api,
id: resourceId,
});
// Enhanced CDK Analytics Telemetry
addConstructMetadata(this, resourceId);

Expand Down
2 changes: 1 addition & 1 deletion packages/aws-cdk-lib/core/lib/prop-injectable.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Construct, IConstruct } from 'constructs';
import { applyInjectors } from './private/prop-injectors-helpers';
import { applyInjectors } from './prop-injectors-helpers';

interface PropertyInjectableConstructConstructor {
readonly PROPERTY_INJECTION_ID: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Construct, IConstruct, Node } from 'constructs';
import { InjectionContext, IPropertyInjector, PropertyInjectors } from '../prop-injectors';
import { InjectionContext, IPropertyInjector, PropertyInjectors } from './prop-injectors';

/**
* This symbol is needed to identify PropertyInjectors.
Expand Down
2 changes: 1 addition & 1 deletion packages/aws-cdk-lib/core/lib/prop-injectors.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Construct, IConstruct } from 'constructs';
import { PROPERTY_INJECTORS_SYMBOL } from './private/prop-injectors-helpers';
import { PROPERTY_INJECTORS_SYMBOL } from './prop-injectors-helpers';

/**
* This defines the values needed for Injection.
Expand Down
2 changes: 1 addition & 1 deletion packages/aws-cdk-lib/core/test/prop-injectors.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Construct } from 'constructs';
import { Annotations, Resource, Stack, Stage } from '../lib';
import { App } from '../lib/app';
import { applyInjectors, findInjectorFromConstruct } from '../lib/private/prop-injectors-helpers';
import { propertyInjectable } from '../lib/prop-injectable';
import { InjectionContext, IPropertyInjector, PropertyInjectors } from '../lib/prop-injectors';
import { applyInjectors, findInjectorFromConstruct } from '../lib/prop-injectors-helpers';

// Define Injectors for our testing
class DoNothingInjector implements IPropertyInjector {
Expand Down
Loading
Loading