-
Notifications
You must be signed in to change notification settings - Fork 0
feature: add tutorial examples #107
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
src/main/resources/schemas/tutorial/step-1-my-first-capability.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| naftiko: "0.5" | ||
| capability: | ||
| exposes: | ||
| - type: "api" | ||
| port: 8081 | ||
| namespace: "tutorial" | ||
| resources: | ||
| - path: "/hello" | ||
| name: "hello" | ||
| label: "My first resource" | ||
| description: "This is a resource to demonstrate a simple Hello, World! API endpoint" | ||
| operations: | ||
| - method: "GET" | ||
| outputParameters: | ||
| - type: "string" | ||
| const: "Hello, World!" |
19 changes: 19 additions & 0 deletions
19
src/main/resources/schemas/tutorial/step-2-forwarding-api-resource.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| naftiko: "0.5" | ||
| capability: | ||
| exposes: | ||
| - type: "api" | ||
| port: 8081 | ||
| namespace: "sample" | ||
| resources: | ||
| - path: "/notion/{{path}}" | ||
| description: "This resource forwards requests to the Notion API, allowing access to any Notion endpoint by specifying the path parameter. For example, a request to /notion/pages would be forwarded to https://api.notion.com/v1/pages." | ||
| forward: | ||
| targetNamespace: notion | ||
| trustedHeaders: | ||
| - Notion-Version | ||
|
|
||
| consumes: | ||
| - type: "http" | ||
| description: "Forwarded requests from the /notion/{path} resource, to be sent to the Notion API" | ||
| namespace: "notion" | ||
| baseUri: "https://api.notion.com/v1/" |
26 changes: 26 additions & 0 deletions
26
src/main/resources/schemas/tutorial/step-3-encapsulating-headers.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| naftiko: "0.5" | ||
| capability: | ||
| exposes: | ||
| - type: "api" | ||
| port: 8081 | ||
| namespace: "sample" | ||
| resources: | ||
| - path: "/notion/{{path}}" | ||
| description: "This resource forwards requests to the Notion API, allowing access to any Notion endpoint by specifying the path parameter. For example, a request to /notion/pages would be forwarded to https://api.notion.com/v1/pages." | ||
| forward: | ||
| targetNamespace: notion | ||
|
|
||
| consumes: | ||
| - type: "http" | ||
| description: "Forwarded requests from the /notion/{path} resource, to be sent to the Notion API" | ||
| namespace: "notion" | ||
| baseUri: "https://api.notion.com/v1/" | ||
| authentication: | ||
| type: "bearer" | ||
| token: "{{notion_api_key}}" | ||
| inputParameters: | ||
| - name: "notion_api_key" | ||
| in: "environment" | ||
| - name: "Notion-Version" | ||
| in: "header" | ||
| value: "2025-09-03" |
47 changes: 47 additions & 0 deletions
47
src/main/resources/schemas/tutorial/step-4-filter-reponse.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| naftiko: "0.5" | ||
| capability: | ||
| exposes: | ||
| - type: "api" | ||
| port: 8081 | ||
| namespace: "sample" | ||
| resources: | ||
| - path: "/notion/users/me" | ||
| description: "This resource is for the specific path /notion/users/me and restricted to nested operations." | ||
| forward: | ||
| targetNamespace: notion | ||
| operations: | ||
| - method: "GET" | ||
| call: "notion.get-me" | ||
| outputParameters: | ||
| - type: "object" | ||
| properties: | ||
| id: | ||
| type: "string" | ||
| mapping: "$.id" | ||
| name: | ||
| type: "string" | ||
| mapping: "$.name" | ||
| type: | ||
| type: "string" | ||
| mapping: "$.type" | ||
|
|
||
| consumes: | ||
| - type: "http" | ||
| description: "Forwarded requests from the /notion/{path} resource, to be sent to the Notion API" | ||
| namespace: "notion" | ||
| baseUri: "https://api.notion.com/v1/" | ||
| authentication: | ||
| type: "bearer" | ||
| token: "{{notion_api_key}}" | ||
| inputParameters: | ||
| - name: "notion_api_key" | ||
| in: "environment" | ||
| - name: "Notion-Version" | ||
| in: "header" | ||
| value: "2025-09-03" | ||
| resources: | ||
| - path: "users/me" | ||
| name: "users-me" | ||
| operations: | ||
| - method: "GET" | ||
| name: "get-me" |
68 changes: 68 additions & 0 deletions
68
src/main/resources/schemas/tutorial/step-5-multi-steps.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| naftiko: "0.5" | ||
| info: | ||
| label: "Tutorial - Step 5 - Multi steps" | ||
| description: "This capability is based on two resources called one after the other. The second step takes an output value of the first one as argument (user_id)" | ||
| tags: | ||
| - Naftiko | ||
| - Tutorial | ||
| created: "2026-02-26" | ||
| modified: "2026-03-04" | ||
| stakeholders: | ||
| - role: "editor" | ||
| fullName: "Navi" | ||
| email: "navi@naftiko.io" | ||
|
|
||
| capability: | ||
| exposes: | ||
| - type: "api" | ||
| port: 8081 | ||
| namespace: "my-capability" | ||
| resources: | ||
| - path: "/notion/my-full-user" | ||
| description: "This resource is for the specific path /notion/my-full-user and restricted to nested operations." | ||
| forward: | ||
| targetNamespace: notion | ||
| operations: | ||
| - method: "GET" | ||
| steps: | ||
| - name: "fetch-me-user" | ||
| type: "call" | ||
| call: "notion.get-me" | ||
| - name: "fetch-user-by-id" | ||
| type: "call" | ||
| call: "notion.get-user" | ||
| with: | ||
| user_id: "{{fetch-me-user.userid}}" | ||
|
|
||
| consumes: | ||
| - type: "http" | ||
| description: "Forwarded requests from the /notion/{path} resource, to be sent to the Notion API" | ||
| namespace: "notion" | ||
| baseUri: "https://api.notion.com/v1/" | ||
| authentication: | ||
| type: "bearer" | ||
| token: "{{notion_api_key}}" | ||
| inputParameters: | ||
| - name: "notion_api_key" | ||
| in: "environment" | ||
| - name: "Notion-Version" | ||
| in: "header" | ||
| value: "2025-09-03" | ||
| resources: | ||
| - path: "users/me" | ||
eskenazit marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| name: "users-me" | ||
| operations: | ||
| - method: "GET" | ||
| name: "get-me" | ||
| outputParameters: | ||
| - name: "userid" | ||
| type: "string" | ||
| value: "$.id" | ||
| - path: "users/{{user_id}}" | ||
| name: "users-by-id" | ||
| inputParameters: | ||
| - name: "user_id" | ||
| in: "path" | ||
| operations: | ||
| - method: "GET" | ||
| name: "get-user" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,90 @@ | ||
| naftiko: "0.5" | ||
| info: | ||
| label: "Tutorial - Step 6 - MCP" | ||
| description: "This is a sample capability specification to demonstrate the MCP exposition feature" | ||
| tags: | ||
| - Naftiko | ||
| - Tutorial | ||
| created: "2026-03-05" | ||
| modified: "2026-03-05" | ||
| stakeholders: | ||
| - role: "editor" | ||
| fullName: "Navi" | ||
| email: "navi@naftiko.io" | ||
|
|
||
| capability: | ||
| exposes: | ||
| - type: "mcp" | ||
| address: "0.0.0.0" | ||
| port: 9091 | ||
| namespace: "notion-mcp" | ||
| description: "MCP server exposing Notion database query capabilities for pre-release participant management." | ||
|
|
||
| tools: | ||
| - name: "query-database" | ||
| description: "Query the Notion pre-release participants database to retrieve committed participants with their name, company, title, location, owner, participation status and comments." | ||
| call: "notion.query-db" | ||
| with: | ||
| datasource_id: "2fe4adce-3d02-8028-bec8-000bfb5cafa2" | ||
| outputParameters: | ||
| - type: "array" | ||
| mapping: "$.results" | ||
| items: | ||
| - type: "object" | ||
| properties: | ||
| name: | ||
| type: "string" | ||
| mapping: "$.properties.Name.title[0].text.content" | ||
| company: | ||
| type: "string" | ||
| mapping: "$.properties.Company.rich_text[0].text.content" | ||
| title: | ||
| type: "string" | ||
| mapping: "$.properties.Title.rich_text[0].text.content" | ||
| location: | ||
| type: "string" | ||
| mapping: "$.properties.Location.rich_text[0].text.content" | ||
| owner: | ||
| type: "string" | ||
| mapping: "$.properties.Owner.people[0].name" | ||
| participation_status: | ||
| type: "string" | ||
| mapping: "$.properties.Participation Status.select.name" | ||
| comments: | ||
| type: "string" | ||
| mapping: "$.properties.Comments.rich_text[0].text.content" | ||
|
|
||
| consumes: | ||
| - type: "http" | ||
| description: "Notion API integration for accessing pre-release participant data stored in Notion." | ||
| namespace: "notion" | ||
| baseUri: "https://api.notion.com/v1/" | ||
| authentication: | ||
| type: "bearer" | ||
| token: "{{notion_api_key}}" | ||
| inputParameters: | ||
| - name: "notion_api_key" | ||
| in: "environment" | ||
| - name: "Notion-Version" | ||
| in: "header" | ||
| value: "2025-09-03" | ||
| resources: | ||
| - inputParameters: | ||
| - name: datasource_id | ||
| in: "path" | ||
| path: "data_sources/{{datasource_id}}/query" | ||
| name: "query" | ||
| label: "Query database resource" | ||
eskenazit marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| operations: | ||
| - method: "POST" | ||
| name: "query-db" | ||
| label: "Query Database" | ||
| body: | | ||
| { | ||
| "filter": { | ||
| "property": "Participation Status", | ||
| "select": { | ||
| "equals": "Committed" | ||
| } | ||
| } | ||
| } | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.