Skip to content

Commit

Permalink
Explore model generation for typescript (finos#701)
Browse files Browse the repository at this point in the history
  • Loading branch information
LeighFinegold committed Dec 24, 2024
1 parent 7e2a717 commit 6a3ac4c
Show file tree
Hide file tree
Showing 15 changed files with 4,943 additions and 47 deletions.
71 changes: 48 additions & 23 deletions calm/draft/2024-10/meta/core.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,53 @@
],
"additionalProperties": true
},
"relationship-type": {
"type": "object",
"properties": {
"interacts": {
"$ref": "#/defs/interacts-type"
},
"connects": {
"$ref": "#/defs/connects-type"
},
"deployed-in": {
"$ref": "#/defs/deployed-in-type"
},
"composed-of": {
"$ref": "#/defs/composed-of-type"
}
},
"oneOf": [
{
"type": "object",
"properties": {
"deployed-in": { "$ref": "#/defs/deployed-in-type" }
},
"required": ["deployed-in"]
},
{
"type": "object",
"properties": {
"composed-of": { "$ref": "#/defs/composed-of-type" }
},
"required": ["composed-of"]
},
{
"type": "object",
"properties": {
"interacts": { "$ref": "#/defs/interacts-type" }
},
"required": ["interacts"]
},
{
"type": "object",
"properties": {
"connects": { "$ref": "#/defs/connects-type" }
},
"required": ["connects"]
}
]
},
"relationship": {
"type": "object",
"properties": {
Expand All @@ -95,29 +142,7 @@
"composed-of": {
"$ref": "#/defs/composed-of-type"
}
},
"oneOf": [
{
"required": [
"deployed-in"
]
},
{
"required": [
"composed-of"
]
},
{
"required": [
"interacts"
]
},
{
"required": [
"connects"
]
}
]
}
},
"protocol": {
"$ref": "#/defs/protocol"
Expand Down
2 changes: 1 addition & 1 deletion calm/draft/2024-10/meta/flow.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
}
},
"controls": {
"$ref": "https://calm.finos.org/draft/2024-10/meta/control.json#/defs/controls"
"$ref": "control.json#/defs/controls"
},
"metadata": {
"$ref": "#/defs/metadata"
Expand Down
71 changes: 48 additions & 23 deletions calm/draft/2024-12/meta/core.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,53 @@
],
"additionalProperties": true
},
"relationship-type": {
"type": "object",
"properties": {
"interacts": {
"$ref": "#/defs/interacts-type"
},
"connects": {
"$ref": "#/defs/connects-type"
},
"deployed-in": {
"$ref": "#/defs/deployed-in-type"
},
"composed-of": {
"$ref": "#/defs/composed-of-type"
}
},
"oneOf": [
{
"type": "object",
"properties": {
"deployed-in": { "$ref": "#/defs/deployed-in-type" }
},
"required": ["deployed-in"]
},
{
"type": "object",
"properties": {
"composed-of": { "$ref": "#/defs/composed-of-type" }
},
"required": ["composed-of"]
},
{
"type": "object",
"properties": {
"interacts": { "$ref": "#/defs/interacts-type" }
},
"required": ["interacts"]
},
{
"type": "object",
"properties": {
"connects": { "$ref": "#/defs/connects-type" }
},
"required": ["connects"]
}
]
},
"relationship": {
"type": "object",
"properties": {
Expand All @@ -101,29 +148,7 @@
"composed-of": {
"$ref": "#/defs/composed-of-type"
}
},
"oneOf": [
{
"required": [
"deployed-in"
]
},
{
"required": [
"composed-of"
]
},
{
"required": [
"interacts"
]
},
{
"required": [
"connects"
]
}
]
}
},
"protocol": {
"$ref": "#/defs/protocol"
Expand Down
18 changes: 18 additions & 0 deletions model-gen/build/calm/2024-12/control-requirement.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/**
* Schema for defining control requirements within the Common Architecture Language Model.
*/
export interface ControlRequirement {
/**
* The unique identifier of this control, which has the potential to be used for linking evidence
*/
"control-id": string;
/**
* The name of the control requirement that provides contextual meaning within a given domain
*/
name: string;
/**
* A more detailed description of the control and information on what a developer needs to consider
*/
description: string;
[k: string]: unknown;
}
6 changes: 6 additions & 0 deletions model-gen/build/calm/2024-12/control.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/**
* Controls model requirements for domains. For example, a security domain contains a series of control requirements
*/
export interface Control {
[k: string]: unknown;
}
168 changes: 168 additions & 0 deletions model-gen/build/calm/2024-12/core.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
export type Metadata = {
[k: string]: unknown;
}[];
export type Metadata1 = {
[k: string]: unknown;
}[];

export interface Core {
nodes?: Node[];
relationships?: Relationship[];
metadata?: Metadata;
controls?: Controls;
flows?: Flow[];
[k: string]: unknown;
}
export interface Node {
"unique-id": string;
"node-type":
| "actor"
| "ecosystem"
| "system"
| "service"
| "database"
| "network"
| "ldap"
| "webclient"
| "data-assset";
name: string;
description: string;
"detailed-architecture"?: string;
"data-classification"?: "Public" | "Confidential" | "Highly Restricted" | "MNPI" | "PII";
"run-as"?: string;
instance?: string;
interfaces?: InterfaceType[];
controls?: Controls;
metadata?: Metadata;
[k: string]: unknown;
}
export interface InterfaceType {
"unique-id": string;
[k: string]: unknown;
}
export interface Controls {
/**
* This interface was referenced by `Controls`'s JSON-Schema definition
* via the `patternProperty` "^[a-zA-Z0-9-]+$".
*/
[k: string]: {
/**
* A description of a control and how it applies to a given architecture
*/
description: string;
requirements: ControlDetail[];
[k: string]: unknown;
};
}
export interface ControlDetail {
/**
* The requirement schema that specifies how a control should be defined
*/
"control-requirement-url": string;
/**
* The configuration of how the control requirement schema is met
*/
"control-config-url"?: string;
[k: string]: unknown;
}
export interface Relationship {
"unique-id": string;
description?: string;
"relationship-type": {
interacts?: InteractsType;
connects?: ConnectsType;
"deployed-in"?: DeployedInType;
"composed-of"?: ComposedOfType;
[k: string]: unknown;
};
protocol?:
| "HTTP"
| "HTTPS"
| "FTP"
| "SFTP"
| "JDBC"
| "WebSocket"
| "SocketIO"
| "LDAP"
| "AMQP"
| "TLS"
| "mTLS"
| "TCP";
authentication?: "Basic" | "OAuth2" | "Kerberos" | "SPNEGO" | "Certificate";
metadata?: Metadata;
controls?: Controls;
[k: string]: unknown;
}
export interface InteractsType {
actor: string;
/**
* @minItems 1
*/
nodes: [string, ...string[]];
[k: string]: unknown;
}
export interface ConnectsType {
source: NodeInterface;
destination: NodeInterface;
[k: string]: unknown;
}
export interface NodeInterface {
node: string;
interfaces?: string[];
[k: string]: unknown;
}
export interface DeployedInType {
container?: string;
/**
* @minItems 1
*/
nodes?: [string, ...string[]];
[k: string]: unknown;
}
export interface ComposedOfType {
container: string;
/**
* @minItems 1
*/
nodes: [string, ...string[]];
[k: string]: unknown;
}
export interface Flow {
/**
* Unique identifier for the flow
*/
"unique-id": string;
/**
* Descriptive name for the business flow
*/
name: string;
/**
* Detailed description of the flow's purpose
*/
description: string;
/**
* Link to a detailed requirement document
*/
"requirement-url"?: string;
transitions: Transition[];
controls?: Controls;
metadata?: Metadata1;
[k: string]: unknown;
}
export interface Transition {
/**
* Unique identifier for the relationship in the architecture
*/
"relationship-unique-id"?: string;
/**
* Indicates the sequence of the relationship in the flow
*/
"sequence-number"?: number;
/**
* Functional summary of what is happening in the transition
*/
summary?: string;
direction?: "source-to-destination" | "destination-to-source";
required?: ["relationship-unique-id", "sequence-number", "summary"];
[k: string]: unknown;
}
21 changes: 21 additions & 0 deletions model-gen/build/calm/2024-12/evidence.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/**
* Schema for defining evidence for control requirements within the Common Architecture Language Model.
*/
export interface Evidence {
evidence: {
/**
* CALM unique-id for future linking and uniquely defining this evidence
*/
"unique-id": string;
/**
* Paths to the evidence relating to a specific control
*/
"evidence-paths": string[];
/**
* URI for the control configuration this evidence relates to
*/
"control-configuration-url": string;
[k: string]: unknown;
};
[k: string]: unknown;
}
Loading

0 comments on commit 6a3ac4c

Please sign in to comment.