Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions assets/example-shapes/banking-system.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ schema: |-
// Permission to withdraw from an account.
// A user can withdraw from an account if the requested amount is less than or equal to the current balance,
// the requested amount is less than or equal to 5000, and the user is the owner of the account.
permission withdraw = check_balance(request.amount, balance) and owner
permission withdraw = check_balance(balance) and owner
}

// Rule to verify if a withdrawal is possible.
// The withdrawal is allowed if the current balance can cover the requested amount,
// and if the requested amount doesn't exceed a limit of 5000.
rule check_balance(amount integer, balance integer) {
(balance >= amount) && (amount <= 5000)
rule check_balance(balance integer) {
(balance >= context.data.amount) && (context.data.amount <= 5000)
}

relationships:
Expand Down
8 changes: 4 additions & 4 deletions assets/example-shapes/disney-plus.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,17 @@ schema: |-
attribute age_rating integer
attribute allowed_region string[]

action view = check_age(request.age, age_rating) and check_region(request.region, allowed_region)
action view = check_age(age_rating) and check_region(allowed_region)
action add_watchlist = user

}

rule check_age(age integer, age_rating integer) {
age >= age_rating
rule check_age(age_rating integer) {
context.data.age >= age_rating
}

rule check_region(region string, allowed_region string[]) {
region in allowed_region
context.data.region in allowed_region
}

relationships:
Expand Down
10 changes: 5 additions & 5 deletions assets/example-shapes/mercury.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ schema: |-
attribute withdraw_limit double
attribute balance double

action withdraw = check_balance(balance, request.amount) and (check_limit(withdraw_limit, request.amount) or owner.approval)
action withdraw = check_balance(balance) and (check_limit(withdraw_limit) or owner.approval)
}

rule check_balance(balance double, amount double) {
balance >= amount
rule check_balance(balance double) {
balance >= context.data.amount
}

rule check_limit(withdraw_limit double, amount double) {
withdraw_limit >= amount
rule check_limit(withdraw_limit double) {
withdraw_limit >= context.data.amount
}

rule check_admin_approval(approval_num integer, admin_approval_limit integer) {
Expand Down
90 changes: 0 additions & 90 deletions assets/example-shapes/weekday.yaml

This file was deleted.

40 changes: 27 additions & 13 deletions docs/api-reference/apidocs.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -1428,9 +1428,6 @@
"properties": {
"computedAttribute": {
"$ref": "#/definitions/ComputedAttribute"
},
"contextAttribute": {
"$ref": "#/definitions/ContextAttribute"
}
},
"description": "Argument defines the type of argument in a Call. It can be either a ComputedAttribute or a ContextAttribute."
Expand Down Expand Up @@ -1779,16 +1776,6 @@
},
"description": "Context encapsulates the information related to a single operation,\nincluding the tuples involved and the associated attributes."
},
"ContextAttribute": {
"type": "object",
"properties": {
"name": {
"type": "string",
"title": "Name of the context attribute"
}
},
"description": "ContextAttribute defines a context attribute which includes its name."
},
"CreateList": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -2283,6 +2270,13 @@
"$ref": "#/definitions/Context",
"description": "Context associated with this request."
},
"scope": {
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/StringArrayValue"
},
"description": "Scope: A map that associates entity types with lists of identifiers. Each entry\nhelps filter requests by specifying which entities are relevant to the operation."
},
"page_size": {
"type": "integer",
"format": "int64",
Expand Down Expand Up @@ -2318,6 +2312,13 @@
"$ref": "#/definitions/Context",
"description": "Context associated with this request."
},
"scope": {
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/StringArrayValue"
},
"description": "Scope: A map that associates entity types with lists of identifiers. Each entry\nhelps filter requests by specifying which entities are relevant to the operation."
},
"page_size": {
"type": "integer",
"format": "int64",
Expand Down Expand Up @@ -3143,6 +3144,19 @@
}
}
},
"StringArrayValue": {
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"type": "string"
},
"description": "The array of strings."
}
},
"description": "Wrapper for an array of strings."
},
"Subject": {
"type": "object",
"properties": {
Expand Down
40 changes: 27 additions & 13 deletions docs/api-reference/openapiv2/apidocs.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -1428,9 +1428,6 @@
"properties": {
"computedAttribute": {
"$ref": "#/definitions/ComputedAttribute"
},
"contextAttribute": {
"$ref": "#/definitions/ContextAttribute"
}
},
"description": "Argument defines the type of argument in a Call. It can be either a ComputedAttribute or a ContextAttribute."
Expand Down Expand Up @@ -1775,16 +1772,6 @@
},
"description": "Context encapsulates the information related to a single operation,\nincluding the tuples involved and the associated attributes."
},
"ContextAttribute": {
"type": "object",
"properties": {
"name": {
"type": "string",
"title": "Name of the context attribute"
}
},
"description": "ContextAttribute defines a context attribute which includes its name."
},
"CreateList": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -2273,6 +2260,13 @@
"$ref": "#/definitions/Context",
"description": "Context associated with this request."
},
"scope": {
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/StringArrayValue"
},
"description": "Scope: A map that associates entity types with lists of identifiers. Each entry\nhelps filter requests by specifying which entities are relevant to the operation."
},
"page_size": {
"type": "integer",
"format": "int64",
Expand Down Expand Up @@ -2308,6 +2302,13 @@
"$ref": "#/definitions/Context",
"description": "Context associated with this request."
},
"scope": {
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/StringArrayValue"
},
"description": "Scope: A map that associates entity types with lists of identifiers. Each entry\nhelps filter requests by specifying which entities are relevant to the operation."
},
"page_size": {
"type": "integer",
"format": "int64",
Expand Down Expand Up @@ -3123,6 +3124,19 @@
}
}
},
"StringArrayValue": {
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"type": "string"
},
"description": "The array of strings."
}
},
"description": "Wrapper for an array of strings."
},
"Subject": {
"type": "object",
"properties": {
Expand Down
Loading