@@ -74,6 +74,51 @@ export default class ServerlessEpsagonPlugin {
74
74
} ,
75
75
} ;
76
76
77
+ // Added: Schema based validation of service config
78
+ // https://github.com/serverless/serverless/releases/tag/v1.78.0
79
+ if ( this . sls . configSchemaHandler ) {
80
+ const newCustomPropSchema = {
81
+ type : 'object' ,
82
+ properties : {
83
+ epsagon : {
84
+ type : 'object' ,
85
+ properties : {
86
+ token : { type : 'string' } ,
87
+ appName : { type : 'string' } ,
88
+ disable : { type : 'boolean' } ,
89
+ metadataOnly : { type : 'boolean' } ,
90
+ handlersDirName : { type : 'string' } ,
91
+ packageJsonPath : { type : 'string' } ,
92
+ collectorURL : { type : 'string' } ,
93
+ ignoredKeys : { type : 'string' } ,
94
+ urlsToIgnore : { type : 'string' } ,
95
+ labels : { type : 'string' } ,
96
+ } ,
97
+ additionalProperties : false ,
98
+ } ,
99
+ } ,
100
+ } ;
101
+ this . sls . configSchemaHandler . defineCustomProperties ( newCustomPropSchema ) ;
102
+
103
+ // Added: defineFunctionProperties schema extension method
104
+ // https://github.com/serverless/serverless/releases/tag/v2.10.0
105
+ if ( this . sls . configSchemaHandler . defineFunctionProperties ) {
106
+ this . sls . configSchemaHandler . defineFunctionProperties ( 'aws' , {
107
+ properties : {
108
+ epsagon : {
109
+ type : 'object' ,
110
+ properties : {
111
+ appName : { type : 'string' } ,
112
+ disable : { type : 'boolean' } ,
113
+ wrapper : { type : 'string' } ,
114
+ } ,
115
+ additionalProperties : false ,
116
+ } ,
117
+ } ,
118
+ } ) ;
119
+ }
120
+ }
121
+
77
122
this . hooks = {
78
123
'after:package:initialize' : this . run . bind ( this ) ,
79
124
'before:deploy:function:packageFunction' : this . run . bind ( this ) ,
0 commit comments