Welcome to the protoscout-schemas repository! This project provides a centralized collection of JSON schemas that define the communication protocol for interacting with the WebScout microservice.
- Request Schema: Defines the structure for requests sent to the WebScout microservice.
- Response Schemas:
- Results Schema: Specifies the format for successful results emitted by the microservice.
- Errors Schema: Details the structure for error messages.
- Specification Schema: Describes the scraping behavior, including parameters, authentication requirements, and how to scrap a particular website.
This repository is designed to be lightweight and easy to integrate into projects requiring JSON schema validation or protocol definition. Whether you're developing in Java, Python, or another language, protoscout-schemas can be used as the foundation for your application's interaction with WebScout.
To include protoscout-schemas in your project, you can clone this repository or add it as a git submodule:
git clone https://github.com/lengors/protoscout-schemas.git
git submodule add https://github.com/lengors/protoscout-schemas.git protoscout-schemas
After adding the protoscout-schemas to your project, you can:
- Validate JSON: Use your preferred JSON schema validation library (e.g.,
ajv
for Node.js,jsonschema
for Python, or Jackson's JSON Schema module for Java) to validate requests, responses, and specifications. - Generate Code: Use tools like
jsonschema2pojo
or similar to generate strongly typed models in your language of choice.
In Python:
from jsonschema import validate
import json
# Load a schema
with open('protoscout-schemas/request.json') as schema_file:
schema = json.load(schema_file)
# Validate a JSON object
request = {"example_key": "example_value"}
validate(instance=request, schema=schema)
Comprehensive documentation and resources are available in the GitHub Wiki.
Contributions are welcome! Please refer to our Contribution Guidelines for more information on how to get involved.
This project is licensed under Apache License Version 2.0, which places it in the public domain.