Skip to content

Commit

Permalink
Update validations for enhancedMetrics
Browse files Browse the repository at this point in the history
and test snapshots for resolvers
  • Loading branch information
DoyleBrendan committed Jul 17, 2024
1 parent 5feabb9 commit 49ff4dc
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/__tests__/resolvers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ describe('Resolvers', () => {
"FieldName": "user",
"Kind": "UNIT",
"MaxBatchSize": undefined,
"MetricsConfig": "DISABLED",
"RequestMappingTemplate": "Content of path/to/mappingTemplates/Query.user.request.vtl",
"ResponseMappingTemplate": "Content of path/to/mappingTemplates/Query.user.response.vtl",
"TypeName": "Query",
Expand Down Expand Up @@ -218,6 +219,7 @@ describe('Resolvers', () => {
"FieldName": "user",
"Kind": "UNIT",
"MaxBatchSize": undefined,
"MetricsConfig": "DISABLED",
"Runtime": Object {
"Name": "APPSYNC_JS",
"RuntimeVersion": "1.0.0",
Expand Down Expand Up @@ -272,6 +274,7 @@ describe('Resolvers', () => {
"FieldName": "user",
"Kind": "UNIT",
"MaxBatchSize": undefined,
"MetricsConfig": "DISABLED",
"TypeName": "Query",
},
"Type": "AWS::AppSync::Resolver",
Expand Down Expand Up @@ -323,6 +326,7 @@ describe('Resolvers', () => {
"FieldName": "user",
"Kind": "UNIT",
"MaxBatchSize": 200,
"MetricsConfig": "DISABLED",
"TypeName": "Query",
},
"Type": "AWS::AppSync::Resolver",
Expand Down Expand Up @@ -380,6 +384,7 @@ describe('Resolvers', () => {
"FieldName": "user",
"Kind": "UNIT",
"MaxBatchSize": undefined,
"MetricsConfig": "DISABLED",
"SyncConfig": Object {
"ConflictDetection": "VERSION",
"ConflictHandler": "LAMBDA",
Expand Down Expand Up @@ -478,6 +483,7 @@ describe('Resolvers', () => {
",
"FieldName": "user",
"Kind": "PIPELINE",
"MetricsConfig": "DISABLED",
"PipelineConfig": Object {
"Functions": Array [
Object {
Expand Down Expand Up @@ -547,6 +553,7 @@ describe('Resolvers', () => {
},
"FieldName": "user",
"Kind": "PIPELINE",
"MetricsConfig": "DISABLED",
"PipelineConfig": Object {
"Functions": Array [
Object {
Expand Down Expand Up @@ -615,6 +622,7 @@ describe('Resolvers', () => {
"Code": "Bundled content of resolvers/getUserFunction.js",
"FieldName": "user",
"Kind": "PIPELINE",
"MetricsConfig": "DISABLED",
"PipelineConfig": Object {
"Functions": Array [
Object {
Expand Down Expand Up @@ -1006,6 +1014,7 @@ describe('Resolvers', () => {
"FieldName": "user",
"Kind": "UNIT",
"MaxBatchSize": undefined,
"MetricsConfig": "DISABLED",
"TypeName": "Query",
},
"Type": "AWS::AppSync::Resolver",
Expand Down Expand Up @@ -1070,6 +1079,7 @@ describe('Resolvers', () => {
"FieldName": "user",
"Kind": "UNIT",
"MaxBatchSize": undefined,
"MetricsConfig": "DISABLED",
"TypeName": "Query",
},
"Type": "AWS::AppSync::Resolver",
Expand Down Expand Up @@ -1134,6 +1144,7 @@ describe('Resolvers', () => {
"FieldName": "user",
"Kind": "UNIT",
"MaxBatchSize": undefined,
"MetricsConfig": "DISABLED",
"TypeName": "Query",
},
"Type": "AWS::AppSync::Resolver",
Expand Down
15 changes: 15 additions & 0 deletions src/validation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -810,6 +810,21 @@ export const appSyncSchema = {
},
required: ['level'],
},
enhancedMetrics: {
type: 'object',
properties: {
DataSourceLevelMetricsBehavior: {
type: 'string',
enum: ['FULL_REQUEST_DATA_SOURCE_METRICS', 'PER_DATA_SOURCE_METRICS'],
errorMessage: "must be 'FULL_REQUEST_DATA_SOURCE_METRICS' or 'PER_DATA_SOURCE_METRICS'",
},
OperationLevelMetricsConfig: {
type: 'string',
enum: ['ENABLED', ' DISABLED'],
errorMessage: "must be 'ENABLED' or ' DISABLED'",
},
}
},
dataSources: {
oneOf: [
{
Expand Down

0 comments on commit 49ff4dc

Please sign in to comment.