swagger.json
Overview
This file is an **OpenAPI 3.0 specification document** describing the RESTful API interface for the [@shapeshiftoss/unchained-proxy](/projects/291/69191) service, version 10.0.0. Its primary purpose is to define the structure, endpoints, request parameters, response formats, and error schemas related to address validation functionality exposed by the service.
The API specification enables automatic generation of client/server code, API documentation, and validation tools. This particular file focuses on a single endpoint `/api/v1/validate/{address}` which checks if a given blockchain address is valid.
Detailed Description
OpenAPI Metadata
OpenAPI Version: 3.0.0
Title: @shapeshiftoss/unchained-proxy
Version: 10.0.0
License: MIT
Components
The [components](/projects/291/69205) section defines reusable schemas for responses and errors used throughout the API:
Schemas
Schema Name | Description | Properties | Required | Notes |
|---|---|---|---|---|
**ValidationResult** | Response indicating validity of an address | `valid` (boolean) | `valid` | No additional properties allowed |
**BadRequestError** | Details about a 400 Bad Request error | `error` (string) | `error` | No additional properties allowed |
**ValidationError** | Details about a 422 Validation Error | `message` (string, enum: "Validation failed"), `details` (object with arbitrary properties) | `message`, `details` | No additional properties allowed |
**InternalServerError** | Details about a 500 Internal Server Error | `message` (string) | `message` | No additional properties allowed |
Paths
GET /api/v1/validate/{address}
Purpose: Validates the given blockchain address.
OperationId:
ValidateAddressTags:
ValidationSecurity: None (no authentication required)
Parameters:
address(path parameter, required, string): The blockchain address to validate.
Responses:
HTTP Code | Description | Schema Reference | Notes |
|---|---|---|---|
200 | Transaction payload | `ValidationResult` | Returns whether the address is valid (`valid: true |
400 | Bad Request | `BadRequestError` | Client sent malformed or invalid request |
422 | Validation Error | `ValidationError` | Address validation failed with details |
500 | Internal Server Error | `InternalServerError` | Unexpected server error occurred |
Example Response (200 OK):
{
"valid": true
}
Usage Example
To validate an address `0x1234...abcd`, a client would perform:
GET /api/v1/validate/0x1234...abcd
Accept: application/json
Possible JSON response on success:
{
"valid": true
}
If the address is malformed:
{
"error": "Invalid address format"
}
Important Implementation Details
Address Validation Logic: While the OpenAPI document does not contain the implementation, the response schema implies the service performs a validation check returning a boolean
validflag.Error Handling: The API clearly distinguishes between client errors (400, 422) and server errors (500), providing structured error messages to enable clients to handle failures gracefully.
Strict Schema Enforcement: All schemas disallow additional properties beyond those defined, ensuring strict contract adherence.
Interaction with Other System Components
Client Applications: Consume this API to verify blockchain addresses before submitting transactions or other operations.
Backend Validation Logic: This endpoint acts as a proxy interface to underlying validation services or libraries that perform address validation.
Error Reporting and Monitoring: The defined error schemas facilitate consistent logging and monitoring of API usage and failure modes.
Visual Diagram
Below is a **flowchart** representing the main endpoint and related response schemas defined in this OpenAPI file.
flowchart TD
A[GET /api/v1/validate/{address}] --> B{Validate Address}
B -->|Valid| C[200 OK: ValidationResult { valid: true }]
B -->|Invalid Input| D[400 Bad Request: BadRequestError { error }]
B -->|Validation Failed| E[422 Validation Error: ValidationError { message, details }]
B -->|Server Error| F[500 Internal Server Error: InternalServerError { message }]
Summary
The [swagger.json](/projects/291/68851) file is a concise but fully specified OpenAPI 3.0 document for the address validation endpoint of the [@shapeshiftoss/unchained-proxy](/projects/291/69191) service. It defines the API interface, response contracts, and error handling, facilitating seamless integration and reliable usage by clients and other system components.