Skip to content

Commit fc1b102

Browse files
committed
docs
1 parent ef70e93 commit fc1b102

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

src/N8NPropertiesBuilder.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,14 @@ export interface N8NPropertiesBuilderConfig {
2121
resource?: IResourceParser,
2222
}
2323

24+
/**
25+
*
26+
* Builds n8n node "properties" from an OpenAPI document.
27+
* It uses a walker to traverse the OpenAPI document and collect the necessary information.
28+
* The collected information is then used to build the n8n node properties.
29+
* The class uses a set of parsers to parse the OpenAPI document and build the n8n node properties.
30+
*
31+
*/
2432
export class N8NPropertiesBuilder {
2533
private readonly doc: OpenAPIV3.Document;
2634
private readonly logger: pino.Logger

src/ResourceParser.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,33 @@
11
import {OpenAPIV3} from "openapi-types";
22
import * as lodash from "lodash";
33

4+
/**
5+
* Extract information for n8n node from OpenAPI resource
6+
*/
47
export interface IResourceParser {
8+
/**
9+
* Name of the resource (e.g. "User")
10+
* @param tag
11+
*/
512
name(tag: OpenAPIV3.TagObject): string
613

14+
/**
15+
* Value of the resource (e.g. "user")
16+
* @note - will be used on operations as well, only "name" will be available for that
17+
*/
718
value(tag: Pick<OpenAPIV3.TagObject, "name">): string
819

20+
/**
21+
* Description of the resource
22+
* @param tag
23+
*/
924
description(tag: OpenAPIV3.TagObject): string
1025
}
1126

27+
/**
28+
* Default behaviour for OpenAPI to n8n resource parser
29+
* It will use tag name as name and value and description as description
30+
*/
1231
export class DefaultResourceParser {
1332
name(tag: OpenAPIV3.TagObject): string {
1433
return lodash.startCase(tag.name);

0 commit comments

Comments
 (0)