Adding new Block via OpenAPI Spec
Importing an Existing OpenAPI Specification
Locate the API Specification: Determine if the API specification exists at a known URL. For example, OpenAI's specification can be found at
https://raw.githubusercontent.com/openai/openai-openapi/master/openapi.yaml.Validate the Specification: Use
https://editor.swagger.io/to validate the OpenAPI spec.Add to System:
Navigate to
packages/omni-server/extensions/omni-core-blocks/server/apis/[NAMESPACE]/[NAMESPACE].yaml.Replace
[NAMESPACE]with your desired namespace (e.g.,openai).Update the
apisection as below.
Example Configuration for OpenAI
namespace: openai
api:
url: https://raw.githubusercontent.com/openai/openai-openapi/master/openapi.yaml
basePath: https://api.openai.com/v1
componentType: OAIComponent31
...Creating an OpenAPI Spec
Generate Draft Spec: If the specification doesn't exist, use tools like "OpenAPI Spec Generator" or request ChatGPT 4 to draft an initial spec.
Validate the Specification: Use
https://editor.swagger.io/to validate the OpenAPI spec.Add to System:
Go to
packages/omni-server/extensions/omni-core-blocks/server/apis/[NAMESPACE]/api/[NAMESPACE].yaml.Replace
[NAMESPACE]with your desired namespace (e.g.,getimg).Update the
apisection as below.
Example Configuration for GetImg
Configure API in YAML
Patch Authentication
We support the following authentication type:
If auth is not defined globally in the original OpenAPI spec, you can patch it in the API yaml /omni-core-blocks/server/apis/[NAMESPACE].yaml
Filter APIs
Configure Blocks in YAML
Basic Metadata
Filter Inputs/Outputs
Transform
Hoist?
Control
Input
type:
customSocket:
Socket Format Options
Base64 image socket option:
Array:
Allow multiple connect
Rename
Run block to Generate Choices
Use JSONATA to Manipulate the format
Patch Security Scheme
Default Result
how to patch when response doesn't have property?
Special Cases
When properties have mutually exclusive or dependencies
Property name is Case-sensitive
When request content type is multipart/form-data, need file type to carry mimetype
Last updated
Was this helpful?