Skip to main content

condAPI is a FastAPI-based application designed to manage and validate JSON schemas.

Project description

condAPI

condAPI is a FastAPI-based application designed to manage and validate JSON schemas. It provides endpoints to set, retrieve, and compare JSON schemas.

Endpoints

GET /

  • Description: API root. Shows available endpoints and their usage.
  • Response:
    {
      "routes": [
        {
          "path": "/",
          "method": "GET",
          "description": "API root. Shows available endpoints and their usage."
        },
        {
          "path": "/details",
          "method": "GET",
          "description": "Returns the current schema details. No parameters required."
        },
        {
          "path": "/compare",
          "method": "POST",
          "description": "Compares a provided JSON schema with the current schema. Requires JSON body."
        },
        {
          "path": "/set_schema",
          "method": "POST",
          "description": "Sets a new schema from provided JSON. Requires JSON body."
        }
      ]
    }
    

GET /details

  • Description: Returns the current schema details.
  • Response:
    • If no schema is set:
      {
        "message": "No schema has been set yet."
      }
      
    • If a schema is set:
      {
        "schema": { ...schema details... }
      }
      

POST /compare

  • Description: Compares a provided JSON schema with the current schema.
  • Request Body: JSON schema to compare.
  • Response:
    • If no schema is set:
      {
        "detail": "No schema has been set yet. Please set a schema first."
      }
      
    • If the provided JSON is invalid:
      {
        "detail": "Invalid JSON"
      }
      
    • If the schema comparison fails:
      {
        "detail": "...error details..."
      }
      
    • If the schema comparison succeeds:
      {
        "message": "Example JSON received and validated successfully"
      }
      

POST /set_schema

  • Description: Sets a new schema from the provided JSON.
  • Request Body: JSON schema to set.
  • Response:
    • If the provided JSON is invalid:
      {
        "detail": "Invalid JSON"
      }
      
    • If the schema validation fails:
      {
        "detail": "...error details..."
      }
      
    • If the schema is successfully set:
      {
        "message": "Example JSON received and validated successfully",
        "generated_schema": { ...schema details... }
      }
      

How to Run

  1. Install the package. It will automatically install its required dependencies:

    pip install condAPI
    
  2. Start the server:

    condapi start
    
  3. To start the server on a different port (default is 8000), use the --port parameter:

    condapi start --port <port_number>
    

License

This project is licensed under the MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

condapi-1.0.1.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

condapi-1.0.1-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file condapi-1.0.1.tar.gz.

File metadata

  • Download URL: condapi-1.0.1.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.10

File hashes

Hashes for condapi-1.0.1.tar.gz
Algorithm Hash digest
SHA256 161cb12ec15068908f66c689746636dc47f609e277a995ae402808bc9e2ee222
MD5 58a3e9e2e0d8505a88a8a6d97a0a03d6
BLAKE2b-256 4dfcf7ea2f32c528ceaa4f1ecd8e58df3d47c4833c68c6abdd0763e68cb2660f

See more details on using hashes here.

File details

Details for the file condapi-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: condapi-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 6.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.10

File hashes

Hashes for condapi-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 035de3673300b28352088e7c3f09db178f4de56beabd3c71e347df007a4479e8
MD5 320903b0c518a49c27191713492ff605
BLAKE2b-256 8245acffbbcab74167335eef9f1c67f85ea669713e65331a14926fd139bbdcc7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page