Skip to content

Commit

Permalink
Merge pull request #19 from labd/addSupportForConditionalSettings
Browse files Browse the repository at this point in the history
feat: Add support for conditional settings
  • Loading branch information
demeyerthom authored Jul 17, 2024
2 parents b991593 + cfc4a01 commit b04f139
Show file tree
Hide file tree
Showing 4 changed files with 220 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .changes/unreleased/Added-20240621-142157.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
kind: Added
body: add support for conditional_settings in component schema
time: 2024-06-21T14:21:57.17321+02:00
61 changes: 61 additions & 0 deletions openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1502,6 +1502,62 @@ components:
description: The numeric id of the original space
required:
- space
Modification:
type: object
properties:
display:
type: string
enum:
- hide
required:
type: boolean
ValidatedObject:
type: object
properties:
type:
type: string
enum:
- field
field_key:
type: string
field_attr:
type: string
enum:
- value
RuleCondition:
type: object
properties:
validated_object:
$ref: '#/components/schemas/ValidatedObject'
validation:
type: string
enum:
- empty
- not_empty
- equals
- not_equals
value:
type: string
nullable: true
ConditionalSettings:
type: object
properties:
modifications:
type: array
description: List of modifications to be applied to the field. Only 1 modification can be applied at a time (hide OR required)
items:
$ref: '#/components/schemas/Modification'
rule_match:
description: Define if all or any of the conditions should be met to apply the modifications
type: string
enum:
- any
- all
rule_conditions:
description: Conditional rules to be applied to the field
type: array
items:
$ref: '#/components/schemas/RuleCondition'
FieldOption:
type: object
properties:
Expand Down Expand Up @@ -1543,6 +1599,11 @@ components:
items:
type: string
description: 'Array of component/content type names: ["post","page","product"]'
conditional_settings:
type: array
description: Array containing the object with information about conditions set on the field
items:
$ref: '#/components/schemas/ConditionalSettings'
customize_toolbar:
type: boolean
description: Customize toolbar in richtext or markdown
Expand Down
79 changes: 79 additions & 0 deletions sbmgmt/main.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

77 changes: 77 additions & 0 deletions schemas/components.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,11 @@ FieldInput:
items:
type: string
description: 'Array of component/content type names: ["post","page","product"]'
conditional_settings:
type: array
description: "Array containing the object with information about conditions set on the field"
items:
$ref: "#/ConditionalSettings"
customize_toolbar:
type: boolean
description: "Customize toolbar in richtext or markdown"
Expand Down Expand Up @@ -319,3 +324,75 @@ FieldOption:
required:
- name
- value

ConditionalSettings:
type: object
properties:
modifications:
type: array
description: "List of modifications to be applied to the field. Only 1 modification can be applied at a time (hide OR required)"
items:
$ref: "#/Modification"
rule_match:
description: "Define if all or any of the conditions should be met to apply the modifications"
type: string
enum: [any, all]
rule_conditions:
description: "Conditional rules to be applied to the field"
type: array
items:
$ref: "#/RuleCondition"


Modification:
type: object
properties:
display:
type: string
enum: [hide]
required:
type: boolean

Properties:
type: object
properties:
component:
$ref: "#/Component"
fields:
type: array
items:
$ref: "#/Field"
total:
type: integer
format: int64
description: The total number of components
cursor:
type: string
description: The cursor to continue from
has_more:
type: boolean
description: Whether there are more components to fetch

RuleCondition:
type: object
properties:
validated_object:
$ref: "#/ValidatedObject"
validation:
type: string
enum: [empty, not_empty, equals, not_equals]
value:
type: string
nullable: true

ValidatedObject:
type: object
properties:
type:
type: string
enum: [field]
field_key:
type: string
field_attr:
type: string
enum: [value]

0 comments on commit b04f139

Please sign in to comment.