Socket
Book a DemoInstallSign in
Socket

@asyncapi/generator-hooks

Package Overview
Dependencies
Maintainers
3
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@asyncapi/generator-hooks

Library with hooks function for templates using AsyncAPI Generator

latest
Source
npmnpm
Version
0.1.0
Version published
Maintainers
3
Created
Source

Generator Hooks

This is a library with generator hooks that are used in more than one template. Use these hooks to not double your work. Read Generator documentation to understand how to configure your template to use external hooks.

This library consists of the following hooks:

Hook nameHook typeDescription
createAsyncapiFilegenerate:afterIt creates AsyncAPI file with content of the spec file passed to the generator. By default it created the file in the root of the generation output directory. This hook also supports custom parameters that user can pass to template generation. Parameter called asyncapiFileDir allows user to specify the location where spec file should be created. To make your template users use this parameter, you need to add it to the configuration of your template like other parameters

Using Hooks library in custom template

  • Add @asyncapi/generator-hooks to dependencies of your template
    npm install @asyncapi/generator-hooks --save 
    
  • Configure your template what hooks you want to use in the template configuration file:
    {
        "hooks": {
            "@asyncapi/generator-hooks": "createAsyncapiFile"
        }
    }
    
  • (Optional) In case the hook that you want to use supports parameters, specify in the configuration what parameters users can specify:
    {
        "parameters": {
            "asyncapiFileDir": {
                "description": "Custom location of the AsyncAPI file that you provided as an input in generation. By default it is located in the root of the output directory",
                "required": false
            }
        },
        "hooks": {
            "@asyncapi/generator-hooks": "createAsyncapiFile"
        }
    }
    

Keywords

asyncapi

FAQs

Package last updated on 14 May 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts