L2 Hub
Pontus
formatter
Split URL

L2 Construct: split_url

formatters url_splitter

Description

SplitUrlEndpoint takes a URL and splits it into its components: URL, Path, Query, and Error.

L2 Data

  1. Provider: pontus
  2. Module: formatter
  3. Action: split_url

Example Step

{
  "name": "insert-your-step-name",
  "type": "l2",
  "l2_data": {
    "provider": "pontus",
    "module": "formatter",
    "action": "split_url",
    "metadata": {}
  }
}
 

Input

Example

{
  "url": "https://www.google.com/search?q=hello\u0026page=1"
}
 

Schema

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://pontus.bpa/pkgs/l2/pontus/formatters/split-url-input",
  "$ref": "#/$defs/SplitUrlInput",
  "$defs": {
    "SplitUrlInput": {
      "properties": {
        "url": {
          "type": "string"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": ["url"]
    }
  }
}
 

Output

Example

{
  "url": "https://www.google.com/search?q=hello\u0026page=1",
  "path": ["www.google.com", "search"],
  "query": {
    "page": ["1"],
    "q": ["hello"]
  },
  "error": {
    "is_error": false
  }
}
 

Schema

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://pontus.bpa/pkgs/l2/pontus/formatters/split-url-output",
  "$ref": "#/$defs/SplitUrlOutput",
  "$defs": {
    "HandlerError": {
      "properties": {
        "is_error": {
          "type": "boolean"
        },
        "errors": {
          "items": {
            "type": "string"
          },
          "type": "array"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": ["is_error"]
    },
    "SplitUrlOutput": {
      "properties": {
        "url": {
          "type": "string"
        },
        "path": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "query": {
          "$ref": "#/$defs/Values"
        },
        "error": {
          "$ref": "#/$defs/HandlerError"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": ["url", "path", "query", "error"]
    },
    "Values": {
      "additionalProperties": {
        "items": {
          "type": "string"
        },
        "type": "array"
      },
      "type": "object"
    }
  }
}