Skip to content

guillerch/condAPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

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

Resources

License

Stars

1 star

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages