Welcome to the OpenCHAMI Schema Repository! This repository serves as the central source for all JSON schemas used across the OpenCHAMI consortium. By maintaining a unified set of schemas, we ensure consistency and compatibility across all OpenCHAMI projects.
This repository contains JSON schemas that define the structure and validation rules for data used across various OpenCHAMI projects. Each schema is generated from Go structs using reflection, ensuring that the schema remains consistent with the underlying data models.
The repository is organized as follows:
- schemas/: This directory contains all the Go structs that will become JSON schemas, each in its own file. Schemas are named according to their purpose or associated data structure.
- examples/: This directory contains example payloads that conform to the schemas. These examples serve as references for developers implementing or integrating with OpenCHAMI components.
- docs/: Documentation related to the schemas, including detailed descriptions and usage guidelines, is found here.
We welcome contributions to the schema repository! Here’s how you can get involved:
- Fork the Repository: Start by forking this repository to your own GitHub account.
- Create a Branch: Create a new branch for your changes.
- Add/Update Schemas: Modify or add new Go structs in the appropriate files. Use reflection to generate the corresponding JSON schema.
- Test Your Changes: Ensure that your changes are valid and conform to the repository’s guidelines. Include example payloads in the
examples/
directory. - Submit a Pull Request: Once your changes are ready, submit a pull request for review.
Schemas in this repository are generated from Go structs using reflection. Here’s an example of how to generate a JSON schema:
package schemas
// Example struct definition
type Node struct {
ID string `json:"id"`
Name string `json:"name"`
IP string `json:"ip"`
}
Each schema is versioned using an envelope/header format. This allows servers to verify the schema version before processing the contained data. Here’s an example:
package schemas
// Envelope structure for schema versioning
type Envelope struct {
SchemaID string `json:"schema_id"`
Version string `json:"version"`
Payload interface{} `json:"payload"`
}
All schemas are published on a webpage for easy access and reference. Servers and clients can use these schemas to validate data and ensure compliance with OpenCHAMI standards.
This repository is licensed under the MIT License. See the LICENSE file for more details.
Thank you for contributing to the OpenCHAMI Schema Repository! Together, we can maintain a consistent and reliable set of data models for all OpenCHAMI projects.