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

Parser does not accept inline configuration for data.csv blocks #76

Closed
traut opened this issue Feb 11, 2024 · 4 comments · Fixed by #77
Closed

Parser does not accept inline configuration for data.csv blocks #76

traut opened this issue Feb 11, 2024 · 4 comments · Fixed by #77
Assignees
Labels
bug Something isn't working

Comments

@traut
Copy link
Member

traut commented Feb 11, 2024

Description

When processing the document with data.csv blocks that contain inline configuration, the parsing failes

Environment

Fabric version: 8d84549
Operating System: macOS Sonoma 14.2.1 (23C71)
Terminal/Shell: zsh

Steps to Reproduce

2.fabric contains:

config data csv {
  delimiter = ";"
}

config data csv "dash-separated" {
  delimiter = "-"
}

data csv "events_a" {
  path = "/tmp/events-a.csv"
}

document "test-document2" {

   data ref {
     base = data.csv.events_a
   }

   data csv "events_b" {
     config {
       delimiter = ","
     }

     path = "/tmp/events-b.csv"
   }

   data csv "events_c" {
     config = config.data.csv.dash-separated
     path = "/tmp/events-b.csv"
   }
}

Expected Behavior

The rendering fails because CSV files are not found.

Actual Behavior

Warnings Plugin 'data csv' does not support configuration, but was provided with one. Remove it. are raised:

$ ../../dist/fabric_darwin_arm64/fabric -document test-document2 -path . -plugins ../../dist/plugins/plugins
Error: Missing block name

  on 2.fabric line 15, in document "test-document2":
  15:    data ref {

Block name was not specified

Warning: Plugin doesn't support configuration

  on  line 0:
  (source code not available)

Plugin 'data csv' does not support configuration, but was provided with one. Remove it.

Error: Failed to read csv file

open /tmp/events-b.csv: no such file or directory

Warning: Plugin doesn't support configuration

  on 2.fabric line 28, in document "test-document2":
  27:    data csv "events_c" {
  28:      config = config.data.csv.dash-separated
  29:      path = "/tmp/events-b.csv"
  30:    }

Plugin 'data csv' does not support configuration, but was provided with one. Remove it.

Error: Failed to read csv file

open /tmp/events-b.csv: no such file or directory
@traut traut added the bug Something isn't working label Feb 11, 2024
@dobarx
Copy link
Contributor

dobarx commented Feb 11, 2024

I think I missed this one. I put delimiter as argument not as configuration parameter. Will fix this.

@traut traut assigned dobarx and unassigned Andrew-Morozko Feb 11, 2024
@traut
Copy link
Member Author

traut commented Feb 11, 2024

gotcha, thank you! reassigned

@dobarx
Copy link
Contributor

dobarx commented Feb 11, 2024

Tried moving it to configuration. Found weird issue with parser when not changing delimiter. For example this one fails:

 data csv "csv_file" {
    path = "./examples/templates/data.csv"
 }

With Plugin 'data csv' has no default configuration and no configuration was provided at the plugin invocation. Provide an inline config block or a config attribute
But this one does not:

data csv "csv_file" {
   config {}
   path = "./examples/templates/data.csv"
}

@Andrew-Morozko Is there a reason why parser requires to declare config {} block even though all configuration parameters are optional?

@Andrew-Morozko
Copy link
Contributor

@dobarx Nope, it's a bug in my code. Will fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants