winglang / winglang/wing

Lint the Wing SDK source code for invalid wing annotations

Open
#705 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

✨ enhancement 🛠️ compiler
Dominant language
TypeScript
Stars
5.4k
Forks
215
Avg merge
2h 9m
Merged PRs (30d)
27

Description

Summary

Compiler warning when JSII manifest has invalid wing annotations

Feature Spec

In the SDK, each resource has a preflight class and an inflight interface that get associated together to form the resource API in the Wing compiler. This association is made with a docstring annotation (as its a piece of metadata we can easily inspect using the .jsii manifest). See for example:

https://github.com/winglang/wing/blob/221c5c4843354a597c676933cbef1e2cc1667621/libs/wingsdk/src/cloud/bucket.ts#L37-L42

But since this is annotation, it's possible for it to contain an invalid value. If we could that the annotation is valid (and fail to import the library if it doesn't), then we could avoid bugs like this one: https://github.com/winglang/wing/pull/701

Use Cases

Preventing bugs in Wing libraries that are written in TypeScript

Implementation Notes

Maybe this logic could be added in wingii, or in the jsii_importer part of the compiler.

Not every class or construct in a Wing library needs to have an @inflight annotation (for example, a resource might exist without any inflight methods). But if the annotation exists, it should be valid.

Component

Compiler

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the annotated resource example in libs/wingsdk/src/cloud/bucket.ts, then inspect the wingii or jsii_importer areas mentioned in the issue. Determine where the .jsii manifest is imported and make an existing @inflight annotation reject invalid values while allowing resources without the annotation; done means invalid SDK annotations fail library import.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
compilers
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.