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

Request: Improve documentation to explain where the JSON schema files used to generate the TS definitions come from #57

Open
Woodz opened this issue Jan 5, 2022 · 2 comments
Labels
documentation Improvements or additions to documentation

Comments

@Woodz
Copy link

Woodz commented Jan 5, 2022

I'm very excited to see the automation involved in this repository to ensure the definitions are kept up to date. However, tracing the origin of the definitions is quite hard because the documentation just states

It aims to automate service file TypeScript definitions based on JSON-schema used by serverless/serverless for validation at the beginning of any Serverless CLI command

However, trying to find which JSON schemas this repo uses is very hard, since there is no mention of where these schemas are on:

With some digging, I found https://github.com/serverless/serverless/blob/739045d9bb03ddefcacceca0bd39f188517b187d/lib/plugins/aws/provider/awsProvider.js#L235 but this doesn't seem to match the TS definitions, so it is probably not the right one.

Specifically, I am trying to find what the purpose of the outputs object at the root level is (not to be confused with the expected resources.Outputs object), but cannot answer this question easily.

I'd appreciate any clarification on the JSON schemas used, thanks!

@fredericbarthelet
Copy link
Contributor

Hi @Woodz, thanks for opening this issue.
JSON schema used by the Serverless framework to validate any service file is programmatically built using a set of APIs, mostly exposed to plugin developers, in order to allow them to expand framework capabilities with new properties.
This API is also used internally by framework core features, as each of them is actually develop in the form of a plugin.

The API is documented in https://www.serverless.com/framework/docs/guides/plugins/custom-configuration#validating-the-configuration and you can indeed find part of the final schema defined internally in the framework:

I'd welcome a PR explaining this in the README of this repository if you feel like doing one :)

As far as outputs object is concerned, you can find the related documentation in https://www.serverless.com/framework/docs/guides/output-variables

@fredericbarthelet fredericbarthelet added the documentation Improvements or additions to documentation label Jan 10, 2022
@kopertop
Copy link

@fredericbarthelet could you explain HOW the deployment of a new release is handled? Just running npm run build does not update the index.d.ts file, and even adding sls deploy afterwards doesn't touch it. In the event this build is NOT automated, is there a way we can run it to get the latest typings?

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

No branches or pull requests

3 participants