-
Notifications
You must be signed in to change notification settings - Fork 28
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
Design schema #97
Changes from all commits
ee0d9a8
3bf2be6
cf48705
7cc3dd3
8e4e992
51c43f9
a690b6e
fbd0cb6
e6164c6
1959078
9d5c5e3
b1d245f
f63e705
e15940c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,37 @@ | ||
{ | ||
"$id": "https://schemas.meshery.io/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_]*$" | ||
}, | ||
"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." | ||
} | ||
"$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_-]*[a-zA-Z0-9_]$", | ||
"description": "A string starting with an alphanumeric character. Spaces and hyphens allowed." | ||
}, | ||
"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." | ||
} | ||
} | ||
} |
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 logical OR. Properties within a selector are interpreted as a logical OR, while the `allow` and `deny` properties are interpreted a logical AND.", | ||
"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" | ||
} | ||
} | ||
}, | ||
"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" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
{ | ||
"$id": "https://schemas.meshery.io/selectors.json", | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"description": "Reusable relationships selectors schema elements", | ||
"$comment": "Sets of selectors are interpreted as a locical OR, while sets of allow/deny are interpreted a logical AND.", | ||
"definitions": { | ||
"from": { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consolidate "from" and "to" into a single selector definition. |
||
"type": "array", | ||
"items": { | ||
"type": "object", | ||
"additionalProperties": false, | ||
"properties": { | ||
"kind": { | ||
"type": "string" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should be a component $ref. |
||
}, | ||
"model": { | ||
"$ref": "../v1beta1/model.json", | ||
"description": "Name of the model implicated by this selector. Learn more at https://docs.meshery.io/concepts/models" | ||
}, | ||
"id": { | ||
"$ref": "../core.json#/uuid" | ||
}, | ||
"match": { | ||
"type": "object", | ||
"additionalProperties": false, | ||
"properties": { | ||
"id": { | ||
"$ref": "../core.json#/uuid" | ||
}, | ||
"self": { | ||
"description": "Defines paths which should be matched with the 'kind' property.", | ||
"type": "array", | ||
"items": { | ||
"type": "string" | ||
} | ||
}, | ||
"kind": { | ||
"description": "Optional property which defines paths which should be matched with 'self'. Here 'kind' is valid Component 'kind' belonging to the above specifed model. eg: If model is Kubernetes, valid 'kind' are 'Pod', 'Secret'. If the value for all paths of 'self' & 'kind' along with the value of all paths inside 'to.match.self' & 'to.match.kind are equal then the component with 'kind' act as an binded component. eg: ClusterRole, ClusterRoleBinding and ServiceAccount. If the paths for ClusterRole & ClusterRoleBinding and ServiceAccount & ClusterRoleBinding are equal then ClusterRoleBinding acts as an binding. Make sure the 'kind' value in 'from' and 'to' should be equal.", | ||
"type": "array", | ||
"items": { | ||
"type": "string" | ||
} | ||
} | ||
} | ||
}, | ||
"patch": { | ||
"type": "object", | ||
"additionalProperties": false, | ||
"properties": { | ||
"patchStrategy": { | ||
"type": "string", | ||
"enum": [ | ||
"replace" | ||
] | ||
}, | ||
"mutatorRef": { | ||
"type": "array", | ||
"items": { | ||
"type": "array", | ||
"items": { | ||
"type": "string" | ||
}, | ||
"description": "The sequence of mutatorRef and mutatedRef must match. eg: mutatorRef: [[config, url], [config, name]], mutatedRef: [[configPatch, value], [name]]. The value [config, url] will be patched at [configPatch, value]. Similarly [config,name] will be patched at [name]." | ||
}, | ||
"description": "JSON ref to value from where patch should be applied." | ||
} | ||
} | ||
} | ||
}, | ||
"description": "Optional fields that are a part of the `from` selector. Absence of a field has an implied * meaning." | ||
} | ||
}, | ||
"to": { | ||
"type": "array", | ||
"items": { | ||
"type": "object", | ||
"additionalProperties": false, | ||
"properties": { | ||
"kind": { | ||
"type": "string" | ||
}, | ||
"model": { | ||
"$ref": "../v1beta1/model.json", | ||
"description": "Model of the implicated component. Learn more at https://docs.meshery.io/concepts/models" | ||
}, | ||
"id": { | ||
"$ref": "../core.json#/uuid", | ||
"description": "Identifier of the implicated component. Learn more at https://docs.meshery.io/concepts/relationships" | ||
}, | ||
"match": { | ||
"type": "object", | ||
"additionalProperties": false, | ||
"properties": { | ||
"id": { | ||
"$ref": "../core.json#/uuid", | ||
"description": "Identifier of the implicated component. Learn more at https://docs.meshery.io/concepts/relationships" | ||
}, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @MUzairS15, @aabidsofi19, @humblenginr, what is this ID in context of the fact that there is a component ID on line 87? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ? |
||
"self": { | ||
"description": "Defines paths which should be matched with 'kind'.", | ||
"type": "array", | ||
"items": { | ||
"type": "string" | ||
} | ||
}, | ||
"kind": { | ||
"description": "Optional property which defines paths which should be matched with 'self'. Here 'kind' is valid Component 'kind' belonging to the above specifed model. eg: If model is Kubernetes, valid 'kind' are 'Pod', 'Secret'. If the value for all paths of 'self' & 'kind' along with the value of all paths inside 'to.match.self' & 'to.match.kind are equal then the component with 'kind' act as an binded component. eg: ClusterRole, ClusterRoleBinding and ServiceAccount. If the paths for ClusterRole & ClusterRoleBinding and ServiceAccount & ClusterRoleBinding are equal then ClusterRoleBinding acts as an binding. Make sure the 'kind' value in 'from' and 'to' should be equal.", | ||
"type": "array", | ||
"items": { | ||
"type": "string" | ||
} | ||
} | ||
} | ||
}, | ||
"patch": { | ||
"type": "object", | ||
"additionalProperties": false, | ||
"properties": { | ||
"patchStrategy": { | ||
"type": "string", | ||
"enum": [ | ||
"replace" | ||
] | ||
}, | ||
"mutatedRef": { | ||
"type": "string", | ||
"description": "JSONPath (https://en.wikipedia.org/wiki/JSONPath) to property to be patched." | ||
} | ||
} | ||
} | ||
}, | ||
"description": "Optional fields that are a part of the `to` selector. Absence of a field has an implied * meaning." | ||
} | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
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.