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

feat: Add support for conditional settings #19

Merged
merged 5 commits into from
Jul 17, 2024
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
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]
Loading