Skip to content

Commit

Permalink
fix(appsync): appsync.HttpDataSourceProps erroneously extends `Base…
Browse files Browse the repository at this point in the history
…DataSourceProps` (#32065)

### Reason for this change
Closes #31979.
Replaces #29689.

In #11185, the `HttpDataSource` class was updated to extend `BackedDataSource` instead of `BaseDataSource`, however the `HttpDataSourceProps` type wasn't updated to reflect this change. This PR makes the `HttpDataSourceProps` type reflect the change.

### Description of changes
Makes the `HttpDataSourceProps` type extend `BackedDataSourceProps`, instead of `BaseDataSourceProps`. This means users are able to provide the `serviceRole` prop without getting a type error.

### Description of how you validated changes
The below code snippet no longer gives an incorrect type error when providing the serviceRole, as it did before:
```ts
import * as appsync from "aws-cdk-lib/aws-appsync";
import type { IRole } from "aws-cdk-lib/aws-iam";

declare const myApi: appsync.GraphqlApi;
declare const serviceRole: IRole;

const stepFunctionHttpDataSource = new appsync.HttpDataSource(
    myApi,
    "MyStepFunctionHTTPDataSource",
    {
        api: myApi,
        authorizationConfig: {
            signingRegion: "eu-west-1",
            signingServiceName: "states",
        },
        endpoint: `https://states.eu-west-1.amazonaws.com`,
        name: "StepFunctionHTTPDataSource",
        // Providing the `serviceRole` now correctly DOESN'T throw a type error
        serviceRole,
    }
);
```
  • Loading branch information
ScottRobinson03 authored Dec 5, 2024
1 parent aed8ad1 commit 4e7f5c4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/aws-cdk-lib/aws-appsync/lib/data-source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ export interface AwsIamConfig {
/**
* Properties for an AppSync http datasource
*/
export interface HttpDataSourceProps extends BaseDataSourceProps {
export interface HttpDataSourceProps extends BackedDataSourceProps {
/**
* The http endpoint
*/
Expand Down

0 comments on commit 4e7f5c4

Please sign in to comment.