API Documentation Outline

The API documentation outlines the available endpoints for interacting with the AISpec codebase.

Endpoints

The following endpoints are available:

  • /generate
    • POST
      • Request Body:
        • schema: JSON schema for the data to be generated.
        • num_samples: Number of data samples to generate.
        • output_format: Format for the generated data (e.g., json, csv).
      • Response Body: Generated data in the specified format.
    • Example Request Body:
      {
                  "schema": {
                    "type": "object",
                    "properties": {
                      "name": { "type": "string" },
                      "age": { "type": "integer" }
                    }
                  },
                  "num_samples": 10,
                  "output_format": "json"
                }
                
    • Example Response Body:
      [
                  { "name": "Alice", "age": 30 },
                  { "name": "Bob", "age": 25 },
                  ...
                ]
                
  • /validate
    • POST
      • Request Body:
        • data: JSON data to be validated.
        • schema: JSON schema to validate the data against.
      • Response Body:
        • valid: Boolean indicating whether the data is valid.
        • errors: Array of validation errors if the data is invalid.
    • Example Request Body:
      {
                  "data": {
                    "name": "Alice",
                    "age": 30
                  },
                  "schema": {
                    "type": "object",
                    "properties": {
                      "name": { "type": "string" },
                      "age": { "type": "integer" }
                    }
                  }
                }
                
    • Example Response Body:
      {
                  "valid": true,
                  "errors": []
                }
                
  • /analyze
    • POST
      • Request Body:
        • data: JSON data to be analyzed.
      • Response Body:
        • schema: JSON schema inferred from the data.
        • statistics: Descriptive statistics for each field in the data.
    • Example Request Body:
      [
                  { "name": "Alice", "age": 30 },
                  { "name": "Bob", "age": 25 },
                  ...
                ]
                
    • Example Response Body:
      {
                  "schema": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "name": { "type": "string" },
                        "age": { "type": "integer" }
                      }
                    }
                  },
                  "statistics": {
                    "name": { "min": "Alice", "max": "Bob", "mean": "...", "std": "..." },
                    "age": { "min": 25, "max": 30, "mean": "...", "std": "..." }
                  }
                }