feat: Add serverless configuration TS typings#297
feat: Add serverless configuration TS typings#297ericrav wants to merge 1 commit intoserverless:masterfrom
Conversation
| */ | ||
| [k: string]: { | ||
| name?: string; | ||
| events?: ( |
There was a problem hiding this comment.
I know this was auto generated, but this library throws when events is not present.
Error: Missing "events" property for function "X". Your function needs at least one "event". Please check the docs for more info.
There was a problem hiding this comment.
Got the source:
serverless-google-cloudfunctions/shared/validate.js
Lines 55 to 63 in b1cdaf2
There was a problem hiding this comment.
Good catch! Perhaps these keys should also be added as required in the JSON schema https://github.com/serverless/serverless-google-cloudfunctions/blob/master/provider/googleProvider.js#L151
There was a problem hiding this comment.
I agree.
Haven't seen much in the way of maintenance on this repo lately. Hopefully this can get some attention and get in there.
There was a problem hiding this comment.
It seems adding event's causes a runtime error. Pretty strange though, as many of the other properties should also fall under this boat:
events: {
type: 'string',
items: { $ref: '#/definitions/cloudFunctionEvent' },
},The type of cloudFunctionEvent nor the events key doesn't seem to matter. Even string threw this error.
Property 'functions[].events' already have a definition - this property might have already been defined by the Serverless framework or one other plugin
|
Love this, having the types for the AWS version is really helpful. |
These are generated from the provider JSON schema using the plugin used to generate the AWS Serverless config typings: https://github.com/serverless/typescript
Usage:
A future PR may add this process to the CI workflow so any provider JSON schema changes are automatically captured in changes to the TypeScript .d.ts file, as is done in
@serverless/typescript