Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposal: Add typing for properties of known Resource types #56

Open
Woodz opened this issue Jan 5, 2022 · 3 comments
Open

Proposal: Add typing for properties of known Resource types #56

Woodz opened this issue Jan 5, 2022 · 3 comments

Comments

@Woodz
Copy link

Woodz commented Jan 5, 2022

Currently the definition of Resources Properties is very generic:

        Properties?: {
          [k: string]: unknown;
        };

This does not provide support for or catch any issues with the properties of known resources. It looks like this is because the core serverless JsonSchema files do not cover known resources (because they don't need to), but it would be still be useful if this could be added into the TS definitions.

There is something similar in https://github.com/awslabs/goformation#updating-cloudformation--sam-resources-in-goformation (which uses the JSON schema from https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cfn-resource-specification.html) which is then leveraged by https://github.com/threadheap/serverless-ide-vscode/tree/master/packages/cloudformation-schema to provide the VSCode plugin Serverless IDE that provides autocomplete for known Resource types when working in serverless.yml files as per https://github.com/threadheap/serverless-ide-vscode/tree/master/packages/cloudformation-schema.

I propose that a similar approach be taken where types are generated from the resource JSON schema published by AWS and these types be combined with the current definition of Resources to improve typing, i.e.

type KnownResource = AwsAppConfigEnvironment | AwsS3Bucket | ...

interface CustomResource {
        Type: string;
        Properties?: {
          [k: string]: unknown;
        };
}

type Resource = KnownResource | CustomResource;
@colesiegel
Copy link

Also looking for this

Was hoping this library would provide type support for the serverless deployment but it doesn't seem to have types for cloudformation resources.

@ebisbe
Copy link

ebisbe commented May 6, 2023

I'm also interested in this feature.

@BrutalSimplicity
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants