Skip to content

Instantly share code, notes, and snippets.

@Dhananjay-JSR
Created December 2, 2024 20:00
Show Gist options
  • Save Dhananjay-JSR/0a45b4b238db33823486245b806d0463 to your computer and use it in GitHub Desktop.
Save Dhananjay-JSR/0a45b4b238db33823486245b806d0463 to your computer and use it in GitHub Desktop.
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"title": "Integration Auth Configuration",
"required": ["authType"],
"properties": {
"authType": {
"type": "string",
"enum": ["NoAuth", "KeyBased"],
"description": "Type of authentication for the integration"
},
"keyBasedAuth": {
"type": "object",
"description": "Configuration for Key-Based Authentication",
"properties": {
"type": {
"type": "string",
"enum": ["BasicAuth", "BearerToken", "APIKey"],
"description": "Specific type of key-based authentication"
},
"fields": {
"type": "array",
"description": "Dynamic fields for authentication configuration",
"items": {
"type": "object",
"required": ["type", "name", "label"],
"properties": {
"type": {
"type": "string",
"enum": ["text", "password", "reference"],
"description": "Input type for the field"
},
"name": {
"type": "string",
"description": "Unique identifier for the field"
},
"label": {
"type": "string",
"description": "User-friendly label for the field"
},
"placeholder": {
"type": "string",
"description": "Placeholder text for the input"
},
"description": {
"type": "string",
"description": "Additional description for the field"
},
"required": {
"type": "boolean",
"description": "Whether the field is mandatory"
}
}
}
},
"authDetails": {
"type": "object",
"description": "Specific authentication method details",
"oneOf": [
{
"title": "Basic Auth",
"type": "object",
"properties": {
"username": {
"oneOf": [
{"type": "string"},
{"$ref": "#/definitions/fieldReference"}
]
},
"password": {
"oneOf": [
{"type": "string"},
{"$ref": "#/definitions/fieldReference"}
]
}
}
},
{
"title": "Bearer Token",
"type": "object",
"properties": {
"token": {
"type": "string"
}
}
},
{
"title": "API Key",
"type": "object",
"properties": {
"key": {
"type": "string"
},
"value": {
"type": "string"
},
"addTo": {
"type": "string",
"enum": ["Headers", "QueryParams", "Body"]
}
}
}
]
}
},
"allOf": [
{
"if": {
"properties": {
"type": {"const": "BasicAuth"}
}
},
"then": {
"required": ["authDetails"]
}
},
{
"if": {
"properties": {
"type": {"const": "BearerToken"}
}
},
"then": {
"required": ["authDetails"]
}
},
{
"if": {
"properties": {
"type": {"const": "APIKey"}
}
},
"then": {
"required": ["authDetails"]
}
}
]
},
"apiSetup": {
"type": "object",
"properties": {
"baseUrl": {
"type": "string",
"format": "uri",
"description": "Base URL for the API"
},
"invalidKeyCodes": {
"type": "array",
"items": {
"type": "number"
},
"description": "HTTP status codes indicating an invalid key"
}
},
"required": ["baseUrl"]
},
"validation": {
"type": "object",
"properties": {
"identifierUrl": {
"type": "string",
"format": "uri",
"description": "URL for authentication validation"
},
"method": {
"type": "string",
"enum": ["GET", "POST", "PUT", "DELETE"],
"description": "HTTP method for validation request"
},
"params": {
"type": "object",
"additionalProperties": {
"type": ["string", "number", "boolean"]
}
},
"headers": {
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"data": {
"type": "object",
"additionalProperties": {
"type": ["string", "number", "boolean", "object", "array"]
}
},
"identifier": {
"type": "string",
"description": "Identifier string for successful validation"
}
}
},
"groupInjection": {
"type": "object",
"properties": {
"params": {
"type": "object",
"additionalProperties": {
"type": ["string", "number", "boolean"]
}
},
"headers": {
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"data": {
"type": "object",
"additionalProperties": {
"type": ["string", "number", "boolean", "object", "array"]
}
}
}
}
},
"definitions": {
"fieldReference": {
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "reference"
},
"fieldName": {
"type": "string",
"description": "Name of the referenced field"
}
},
"required": ["type", "fieldName"]
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment