Skip to content

Commit

Permalink
code(pkg/config) - provide flag for model field
Browse files Browse the repository at this point in the history
  • Loading branch information
PxyUp committed Feb 1, 2024
1 parent 7181093 commit aa1e004
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -559,13 +559,15 @@ type Model struct {
ObjectConfig *ObjectConfig `yaml:"object_config" json:"object_config"`
ArrayConfig *ArrayConfig `json:"array_config" yaml:"array_config"`
BaseField *BaseField `json:"base_field" yaml:"base_field"`
IsArray bool `json:"is_array" yaml:"is_array"`
}
```

Config can be one of:
- [ObjectConfig](#objectconfig) - configuration of object format
- [ArrayConfig](#arrayconfig) - configuration of array format
- [BaseField](#basefield) - configuration of single/generated field
- IsArray - bool[false] - force indicate that field is array(usable in case of [model field](#model-field) with [base field](#basefield))

Example:
```json
Expand Down
1 change: 1 addition & 0 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ type Model struct {
ObjectConfig *ObjectConfig `yaml:"object_config" json:"object_config"`
ArrayConfig *ArrayConfig `json:"array_config" yaml:"array_config"`
BaseField *BaseField `json:"base_field" yaml:"base_field"`
IsArray bool `json:"is_array" yaml:"is_array"`
}

type ConnectorConfig struct {
Expand Down
2 changes: 1 addition & 1 deletion pkg/processor/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func (p *processor) Process(input builder.Jsonable) (*parser.ParseResult, error)
result, err := p.engine.Get(p.model, nil, nil, input)
if p.notifier != nil {
isArray := false
if p.model.ArrayConfig != nil {
if p.model.ArrayConfig != nil || p.model.IsArray {
isArray = true
}
if p.notifierCfg != nil {
Expand Down

0 comments on commit aa1e004

Please sign in to comment.