Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Design schema #97

Merged
merged 14 commits into from
Jul 25, 2024
36 changes: 36 additions & 0 deletions schemas/constructs/core.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"$id": "../core.json",
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "Reusable core schema elements",
"definitions": {
"inputString": {
"type": "string",
"pattern": "^[a-zA-Z_][a-zA-Z0-9_]*$"
leecalcote marked this conversation as resolved.
Show resolved Hide resolved
},
"versionString": {
"type": "string",
"minLength": 2,
"maxLength": 100,
"description": "API version of the object",
"pattern": "([a-z.])*(?!^\/)v(alpha|beta|[0-9]+)([.-]*[a-z0-9]+)*$",
"example": [
"v1",
"v1alpha1",
"v2beta3",
"v1.custom-suffix"
]
},
"semverString": {
"type": "string",
"minLength": 5,
"maxLength": 100,
"pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+(-[0-9A-Za-z-]+(\\.[0-9A-Za-z-]+)*)?(\\+[0-9A-Za-z-]+(\\.[0-9A-Za-z-]+)*)?$",
"description": "A valid semantic version string between 5 and 256 characters. The pattern allows for a major.minor.patch version followed by an optional pre-release tag like '-alpha' or '-beta.2' and an optional build metadata tag like '+build.1."
},
"uuid": {
"type": "string",
"format": "uuid",
"description": "A Universally Unique Identifier used to uniquely identify entites in Meshery. The UUID core defintion is used across different schemas."
}
}
}
6 changes: 3 additions & 3 deletions schemas/constructs/v1alpha1/component.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@
"description": "Meshery manages components in accordance with their specific capabilities. This field explicitly identifies those capabilities largely by what actions a given component supports; e.g. metric-scrape, sub-interface, and so on. This field is extensible. ComponentDefinitions made define a broad array of capabilities, which are in-turn dynamically interpretted by Meshery for full lifecycle management."
},
"name": {
"$ref": "https://schemas.meshery.io/core.json#inputString",
"$ref": "../core.json#inputString",
"description": "Name of the component."
},
"version": {
"$ref": "https://schemas.meshery.io/core.json#versionString",
"$ref": "../core.json#versionString",
"description": "Version of the component."
}
}
Expand All @@ -50,7 +50,7 @@
"description": "Model of the component. Learn more at https://docs.meshery.io/concepts/models"
},
"displayName": {
"$ref": "https://schemas.meshery.io/core.json#inputString",
"$ref": "../core.json#inputString",
"description": "Display name of the component."
},
"format": {
Expand Down
15 changes: 0 additions & 15 deletions schemas/constructs/v1alpha1/core.json

This file was deleted.

9 changes: 5 additions & 4 deletions schemas/constructs/v1alpha1/model.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,27 @@
"description": "Meshery Models serve as a portable unit of packaging to define managed entities, their relationships, and capabilities.",
"additionalProperties": false,
"type": "object",
"required": ["status",
"required": [
"status",
"name",
"version",
"category"
],
"properties": {
"name": {
"$ref": "https://schemas.meshery.io/v1alpha1/core.json#inputString",
"$ref": "../core.json#inputString",
"description": "The name for the model."
},
"displayName": {
"$ref": "https://schemas.meshery.io/v1alpha1/core.json#inputString",
"$ref": "../core.json#inputString",
"description": "The display name for the model."
},
"status": {
"type": "string",
"description": "Status of model, e.g. Registered, Ignored, Enabled ..."
},
"version": {
"$ref": "https://schemas.meshery.io/v1alpha1/core.json#versionString",
"$ref": "../core.json#versionString",
"description": "Version of the model."
},
"category": {
Expand Down
4 changes: 2 additions & 2 deletions schemas/constructs/v1alpha1/selectors.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"type": "string"
},
"version": {
"$ref": "https://schemas.meshery.io/v1alpha1/core.json#versionString"
"$ref": "../core.json#/versionString"
},
"match": {
"type": "object",
Expand Down Expand Up @@ -77,7 +77,7 @@
"type": "string"
},
"version": {
"$ref": "https://schemas.meshery.io/v1alpha1/core.json#versionString"
"$ref": "../core.json#/versionString"
},
"match": {
"type": "object",
Expand Down
32 changes: 0 additions & 32 deletions schemas/constructs/v1alpha2/core.json

This file was deleted.

14 changes: 7 additions & 7 deletions schemas/constructs/v1alpha2/relationship.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
"type": "object",
"properties": {
"schemaVersion": {
"$ref": "./core.json#/definitions/versionString",
"$ref": "../core.json#/versionString",
"description": "Specifies the version of the schema used for the definition."
},
"version": {
"$ref": "./core.json#/definitions/semverString",
"$ref": "../core.json#/semverString",
"description": "Specifies the version of the definition."
},
"kind": {
"$ref": "./core.json#/definitions/inputString",
"$ref": "../core.json#/inputString",
"description": "Kind of the Relationship.",
"enum": [
"hierarchical",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do these enums need to be Capitalized?

Expand All @@ -32,23 +32,23 @@
]
},
"type": {
"$ref": "./core.json#/definitions/inputString",
"$ref": "../core.json#/inputString",
"description": "Classification of relationships. Used to group relationships similar in nature."
},
"subType": {
"$ref": "./core.json#/definitions/inputString",
"$ref": "../core.json#/inputString",
"description": "Used for further classification of Relationships. Type and SubType together identifies a Relationship."
},
"evaluationQuery": {
"$ref": "./core.json#/definitions/inputString",
"$ref": "../core.json#/inputString",
"description": "Determines the policy rule to be used for the evaluation of the relationship."
},
"metadata": {
"type": "object",
"description": "Metadata contains additional information associated with the Relationship.",
"properties": {
"description": {
"$ref": "./core.json#/definitions/inputString",
"$ref": "../core.json#/inputString",
"description": "Description of the Relationship."
}
}
Expand Down
4 changes: 2 additions & 2 deletions schemas/constructs/v1alpha2/selectors.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"description": "Model of the component. Learn more at https://docs.meshery.io/concepts/models"
},
"version": {
"$ref": "./core.json#/definitions/semverString"
"$ref": "../core.json#/semverString"
},
"match": {
"type": "object",
Expand Down Expand Up @@ -80,7 +80,7 @@
"description": "Model of the component. Learn more at https://docs.meshery.io/concepts/models"
},
"version": {
"$ref": "./core.json#/definitions/semverString"
"$ref": "../core.json#/semverString"
},
"match": {
"type": "object",
Expand Down
107 changes: 107 additions & 0 deletions schemas/constructs/v1alpha3/relationship.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
{
"$id": "https://schemas.meshery.io/relationship.json",
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "Relationships define the nature of interaction between interconnected components in Meshery. The combination of relationship properties kind, type, and subtype characterize various genealogical relations among and between components. Relationships have selectors, selector sets, metadata, and optional parameters. Learn more at https://docs.meshery.io/concepts/logical/relationships.",
"required": [
"schemaVersion",
"version",
"model",
"kind",
"type",
"subType"
],
"additionalProperties": false,
"type": "object",
"properties": {
"schemaVersion": {
"$ref": "../core.json#/versionString",
"description": "Specifies the version of the schema used for the relationship definition."
},
"version": {
"$ref": "../core.json#/semverString",
"description": "Specifies the version of the relationship definition."
},
"model": {
"$ref": "../v1beta1/model.json",
"description": "Name of the model in which this relationship is packaged."
},
"kind": {
"$ref": "../core.json#/inputString",
"description": "Kind of the Relationship. Learn more about relationships - https://docs.meshery.io/concepts/logical/relationships.",
"enum": [
"Hierarchical",
"Edge",
"Sibling"
]
},
"type": {
"$ref": "../core.json#/inputString",
"description": "Classification of relationships. Used to group relationships similar in nature."
},
"subType": {
"$ref": "../core.json#/inputString",
"description": "Most granular unit of relationship classification. The combination of Kind, Type and SubType together uniquely identify a Relationship."
},
"evaluationQuery": {
"$ref": "../core.json#/inputString",
"description": "Optional. Assigns the policy to be used for the evaluation of the relationship. Deprecation Notice: In the future, this property is either to be removed or to it is to be an array of optional policy $refs."
},
"metadata": {
"type": "object",
"description": "Metadata contains additional information associated with the Relationship.",
"properties": {
"description": {
"$ref": "../core.json#/inputString",
"description": "Characteristization of the meaning of the relationship and its relevance to both Meshery and entities under management."
}
}
},
"selectors": {
"type": "array",
"description": "Selectors are organized as an array, with each item containing a distinct set of selectors that share a common functionality. This structure allows for flexibility in defining relationships, even when different components are involved.",
"$comment": "Sets of selectors are interpreted as a locical OR, while sets of allow/deny are interpreted a logical AND.",
leecalcote marked this conversation as resolved.
Show resolved Hide resolved
"items": {
"type": "object",
"description": "Optional selectors used to match Components. Absence of a selector means that it is applied to all Components.",
"additionalProperties": false,
"required": [
"allow"
],
"properties": {
"deny": {
"type": "object",
"description": "Optional selectors used to define relationships which should not be created / is restricted.",
"required": [
"to",
"from"
],
"properties": {
"from": {
"$ref": "./selectors.json#/definitions/from"
},
"to": {
"$ref": "./selectors.json#/definitions/to"
}
}
Comment on lines +72 to +85
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be replaced with a selector $ref.

},
"allow": {
"type": "object",
"description": "Selectors used to define relationships which are allowed.",
"required": [
"to",
"from"
],
"properties": {
"from": {
"$ref": "./selectors.json#/definitions/from"
},
"to": {
"$ref": "./selectors.json#/definitions/to"
}
}
}
}
}
}
}
}
Loading
Loading