If youβre using Meshery or if you like the project, please β this repository to show your support! π€©
Meshery follows schema-driven development. As a project, Meshery has different types of schemas. Some schemas are external facing, and some internal to Meshery itself. This repository serves as a central location for storing schemas from which all Meshery components can take reference.
Meshery schemas offer a powerful system designed for:
- Model-Driven Management: Meshery uses explicit models for describing infrastructure and applications.
- Dynamic Discovery: The ability to process different kinds of relationships and styles, enables a sophisticated system that can adapt to many configurations.
- Lifecycle Management: The schema properties track status and lifecycle of resources.
- Extensibility: Open-ended metadata and modular schema components enable expansion and customization.
- Visual Representation: The properties for styling of edges and nodes is for creating a user friendly visual representation.
- Automated Operations: The schemas can support validation and automated configuration of infrastructure and applications, and patching.
Meshery schemas file structure is defined based on definitions and schemas, checkout docs.meshery.io to learn more about definitions and schemas.
Definitions
- model
- version
- model.definition
- components
- component-1.definition
- component-2.definition
- policy.definition
- relationship.definition
- version
Schemas
- constructs
- schema.version // Schema version
- component.schema
- model.schema
- policy.schema
- relationship.schema
- schema.version // Schema version
REST API
- swagger.yaml
Adapters
- meshes.proto
Β
Our projects are community-built and welcome collaboration. π Be sure to see the Contributor Welcome Guide and Community Handbook for a tour of resources available to you and the Repository Overview for a cursory description of repository by technology and programming language. Jump into community Slack or discussion forum to participate.
MeshMates are experienced community members, who will help you learn your way around, discover live projects, and expand your community network. Connect with a Meshmate today!
Find out more on the Meshery community.
βοΈ Join any or all of the weekly meetings on community calendar.
βοΈ Watch community meeting recordings.
βοΈ Fill-in a community member form to gain access to community resources.
βοΈ Discuss in the Community Forum.
βοΈ Explore more in the Community Handbook.
Please do! We're a warm and welcoming community of open source contributors. All types of contributions are welcome. Please read:
- General Contributor Guide - Overview of contribution processes
- Schema Contributor Guide - Schema-specific development workflows and guidelines
Meshery follows a Schema-Driven Development (SDD) approach. This means that the structure of data used in the application is defined using schemas, ensuring consistency, validation, and code generation across the project.
Meshery uses OpenAPI v3 specification to define schemas. Given the complexity of the project, where multiple constructs and APIs exist, we adopt a structured approach to schema management:
- Schemas are versioned to maintain backward compatibility.
- Schemas are modular to support different components of Meshery independently.
- Schemas are used for validation, API definition, and automatic code generation.
All schemas are stored in the schemas
directory at the root of the project. The structure follows:
schemas/
constructs/
<schema-version>/ # e.g., v1beta1
<construct>/ # e.g., model, component
<construct>.json # Schema definition for the construct (noun)
subschemas/ # Any subschemas used within the construct
openapi.yml # OpenAPI schema defining API operations (verbs like create, update, delete)
constructs/
β Contains schemas for different versions.<schema-version>/
β Each schema version (e.g.,v1beta1
,v1alpha2
) is a separate directory.<construct>/
β Each construct (e.g.,capability
,category
) has its own folder.<construct>.json
β Defines the schema for the noun (i.e., the entity).subschemas/
β Contains reusable subschemas for modularity.openapi.yml
β Defines API operations (verbs:create
,update
,delete
) and serves as the entry point for the schema.
This approach ensures that schemas are well-organized, reusable, and scalable across different Meshery components.
Meshery supports automatic code generation for:
- Golang (structs and types)
- TypeScript (interfaces and types)
The schema-to-code mapping is defined in generate.sh
, which automates the generation process.
To generate Go structs from schemas, use:
make golang-generate
To generate TypeScript types from schemas, use:
make generate-ts
Example mapping in generate.sh
:
generate_schema_models <construct> <schema-version>
generate_schema_models "capability" "v1alpha1"
generate_schema_models "category" "v1beta1"
generate_schema_models "component" "v1beta1"
generate_schema_models "pattern" "v1beta1" "schemas/constructs/v1beta1/design/openapi.yml"
generate_schema_models "core" "v1alpha1"
generate_schema_models "catalog" "v1alpha2"
- The package name matches the construct name.
- Example: For the
capability
construct inv1alpha1
, the generated Go code will be in:models/v1alpha1/capability/capability.go
./generate-golang.sh
πΉ Processing: capability (v1alpha1)...
β
Generated: models/v1alpha1/capability/capability.go
πΉ Processing: category (v1beta1)...
β
Generated: models/v1beta1/category/category.go
πΉ Processing: pattern (v1beta1)...
β
Generated: models/v1beta1/pattern/pattern.go
πΉ Processing: core (v1alpha1)...
β
Generated: models/v1alpha1/core/core.go
πΉ Processing: catalog (v1alpha2)...
β
Generated: models/v1alpha2/catalog/catalog.go
This ensures that schemas remain the single source of truth, making development efficient, consistent, and scalable.
This repository and site are available as open-source under the terms of the Apache 2.0 License.
MESHERY IS A CLOUD NATIVE COMPUTING FOUNDATION PROJECT