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

AWS Construct Library: Construct Specs and API Linting #181

Closed
eladb opened this issue Jun 27, 2018 · 0 comments
Closed

AWS Construct Library: Construct Specs and API Linting #181

eladb opened this issue Jun 27, 2018 · 0 comments

Comments

@eladb
Copy link
Contributor

eladb commented Jun 27, 2018

In order to enable rich tooling and IDE integration for AWS Construct Libraries, we propose that libraries publish some form of specification which describes the various capabilities of these constructs. This will also enable "linting" the surface area of the AWS Construct Library.

For example, the spec should include information such as:

  • The set of props needed to create the construct (along with documentation and type info).
  • The set of attributes the construct exposes
  • Which events can be subscribed to (onXxx methods)
  • Which metrics are emitted by the construct (metricOfXxx methods)
  • Which grants can be given by the construct (grantXxx methods).
  • CodePipeline actions (addToPipeline) Move the CodeCommit and CodeBuild Actions from the codepipeline module into their @aws-cdk modules #238
  • What information is needed in order to import an external construct to the stack (Xxx.import(,,props))?
  • Can this construct be used as a target for a CloudWatch Event Rule?
  • Documentation

This mechanism can further be used to annotate constructs with information that tooling can benefit from, such as runtime API (illustratively, table.putItem()), labels which can be used to discover this construct, etc.

We can leverage the jsii schema to reflect on the APIs a library exports and use this information to produce this information quite easily.

Furthermore, by reflecting on the jsii schema of the library, we can "lint" the API and enforce a set of rules to make sure APIs are consistent and enforce capabilities across all of our libraries.

Other things we should include in this toolset:

  • Verify that 3rd party dependencies don't introduce licensing issues
  • Simplify package.json by providing scripts for the various targets ("build", "test", "integ"), so we don't need to duplicate them.
  • A version of pkglint
  • Lint package names in all supported languages
  • Lint that packages don't take any dependency on non-permissive licenses
eladb pushed a commit to aws/jsii that referenced this issue Dec 5, 2018
jsii-reflect is a library for strong-type reflection of jsii type systems.
it creates an in-memory object graph from .jsii module specifications
and exposes a rich API for exploring the type system.

jsii-tree is a command-line utility bundled with jsii-reflect
which prints an ascii tree of a jsii type system.

oo-ascii-tree is an object-oriented library for producing ascii trees.
it supports multi-line nodes and some other cool features. 

See README files for more details.

Related: aws/aws-cdk#181
@eladb eladb closed this as completed Aug 27, 2019
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