apify-schema-tool
TypeScript icon, indicating that this package has built-in type declarations

0.0.1 • Public • Published

Syntax

You should create a type named Input in your main.ts

The Typescript type definition should get picked up automatically, and then you can annotate the rest with JSDoc, like so

interface Input {
  /**
  * @name Name
  * @description Name of the Account
  * @prefill "John"
  */
  name: string

  /**
  * @name Role
  * @description Role of the account
  */
  role: 'admin' | 'normal'
}

const {
  // It can do defaults like so!
  role = 'admin'
} = (await Actor.getInput<Input>())!

Result:

{
    "type": "object",
    "properties": {
        "name": {
            "title": "Name",
            "description": "Name of the Account",
            "editor": "textfield",
            "prefill": "John",
            "type": "string"
        },
        "role": {
            "type": "string",
            "editor": "select",
            "title": "Role",
            "description": "Role of the account",
            "default": "admin",
            "enum": [
                "admin",
                "normal"
            ]
        }
    },
    "required": []
}

Usage

tsx ./index.ts print <folder_with_main.ts>

Or you can get help with

tsx ./index.ts help print

Readme

Keywords

none

Package Sidebar

Install

npm i apify-schema-tool

Weekly Downloads

2

Version

0.0.1

License

ISC

Unpacked Size

125 kB

Total Files

10

Last publish

Collaborators

  • jameender