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: support yaml evaluator #206

Merged
merged 16 commits into from
Jan 4, 2023

Commits on Jan 3, 2023

  1. feat: support yaml evaluator

    Signed-off-by: Suraj Banakar <surajrbanakar@gmail.com>
    
    feat: wip try replacing json evaluator with a generic file type evaluator
    - TODO:
     - still need a way to make the json_evaluator_model more composable
     - replace instances of `json` with the `MUaler` interface
     - implement `MUaler` interface for yaml and json
    
    Signed-off-by: Suraj Banakar <surajrbanakar@gmail.com>
    
    feat: wip pass `yaml` as filetype to `FilePathSync`
    - check `yaml.Unmarshal` not able to `Unmarshal` to `json.rawMessage` which is just `[]byte` with `MarshalJSON` and `UnmarshalJSON`
    - `FileTypeEvaluator` didn't turn out to be such a good idea because we are reliant on `gojsonschema` to test json schema
    - add `example_flags.yaml` file based on `examples_flags.json`
    refactor: remove traces of `FileTypeEvaluator`
    
    Signed-off-by: Suraj Banakar <surajrbanakar@gmail.com>
    
    feat: wip try yaml->map->json conversion
    - the code compiles and the converted json seems to look good but flagd throws error
    - need to look into this ^
    
    Signed-off-by: Suraj Banakar <surajrbanakar@gmail.com>
    
    feat: wip remove yaml annotationt and redundant code
    - yaml config -> json config -> json.Unmarshal (<- error here)
    
    Signed-off-by: Suraj Banakar <surajrbanakar@gmail.com>
    
    feat: wip add indentations in the json converted from yaml
    - because the evaluator transposer function doesn't understand json without indentations well
    - needs more testing
    
    Signed-off-by: Suraj Banakar <surajrbanakar@gmail.com>
    
    feat: refactor
    
    Signed-off-by: Suraj Banakar <surajrbanakar@gmail.com>
    
    feat: add `yaml` and `yml` in evaluator switch case
    
    feat: fix go.mod
    - add json-iterator package
    
    Signed-off-by: Suraj Banakar <surajrbanakar@gmail.com>
    vadasambar authored and toddbaert committed Jan 3, 2023
    Configuration menu
    Copy the full SHA
    2349935 View commit details
    Browse the repository at this point in the history
  2. fix: go lint error

    Signed-off-by: Suraj Banakar <surajrbanakar@gmail.com>
    vadasambar authored and toddbaert committed Jan 3, 2023
    Configuration menu
    Copy the full SHA
    e1dcd37 View commit details
    Browse the repository at this point in the history
  3. fix: re-word code comment around jsoniter.Marshal

    Signed-off-by: Suraj Banakar <surajrbanakar@gmail.com>
    vadasambar authored and toddbaert committed Jan 3, 2023
    Configuration menu
    Copy the full SHA
    916746b View commit details
    Browse the repository at this point in the history
  4. fix: use yaml.v3 instead of yaml.v2

    - yaml.v2 has a bug where the sub-maps are converted to `map[interface]interface{}` instead of `map[string]interface{}`
    
    Signed-off-by: Suraj Banakar <surajrbanakar@gmail.com>
    vadasambar authored and toddbaert committed Jan 3, 2023
    Configuration menu
    Copy the full SHA
    4d2e83a View commit details
    Browse the repository at this point in the history
  5. fix: add constants for file types

    - update go.mod and go.sum
    
    Signed-off-by: Suraj Banakar <surajrbanakar@gmail.com>
    vadasambar authored and toddbaert committed Jan 3, 2023
    Configuration menu
    Copy the full SHA
    1b0a0a2 View commit details
    Browse the repository at this point in the history
  6. fix: remove filetype abstraction

    - didn't make a lot of sense to me
    
    Signed-off-by: Suraj Banakar <surajrbanakar@gmail.com>
    vadasambar authored and toddbaert committed Jan 3, 2023
    Configuration menu
    Copy the full SHA
    565dd27 View commit details
    Browse the repository at this point in the history
  7. docs: update info about supported cli flags

    Signed-off-by: Suraj Banakar <surajrbanakar@gmail.com>
    vadasambar authored and toddbaert committed Jan 3, 2023
    Configuration menu
    Copy the full SHA
    15784c1 View commit details
    Browse the repository at this point in the history
  8. fix: tests failing

    - don't check the file type in when fetching file in filepathsync
    
    Signed-off-by: Suraj Banakar <surajrbanakar@gmail.com>
    vadasambar authored and toddbaert committed Jan 3, 2023
    Configuration menu
    Copy the full SHA
    80159bd View commit details
    Browse the repository at this point in the history
  9. fix: return nil instead of err when fetching file via filepathsync

    Signed-off-by: Suraj Banakar <surajrbanakar@gmail.com>
    vadasambar authored and toddbaert committed Jan 3, 2023
    Configuration menu
    Copy the full SHA
    a9482f4 View commit details
    Browse the repository at this point in the history
  10. Revert "fix: tests failing"

    This reverts commit a2efb06.
    
    Signed-off-by: Suraj Banakar <surajrbanakar@gmail.com>
    vadasambar authored and toddbaert committed Jan 3, 2023
    Configuration menu
    Copy the full SHA
    744b608 View commit details
    Browse the repository at this point in the history
  11. test: add json as the default FileType to fix tests

    - not sure if this is the best way to do this
    
    Signed-off-by: Suraj Banakar <surajrbanakar@gmail.com>
    vadasambar authored and toddbaert committed Jan 3, 2023
    Configuration menu
    Copy the full SHA
    806fbca View commit details
    Browse the repository at this point in the history
  12. fix: small spacing typo/bug

    Signed-off-by: Suraj Banakar <surajrbanakar@gmail.com>
    vadasambar authored and toddbaert committed Jan 3, 2023
    Configuration menu
    Copy the full SHA
    ef4ae28 View commit details
    Browse the repository at this point in the history
  13. docs: fix spacing ifflag -> if flag

    Co-authored-by: Michael Beemer <beeme1mr@users.noreply.github.com>
    Signed-off-by: Suraj Banakar(बानकर) | スラジ <34534103+vadasambar@users.noreply.github.com>
    2 people authored and toddbaert committed Jan 3, 2023
    Configuration menu
    Copy the full SHA
    36a715a View commit details
    Browse the repository at this point in the history
  14. fix: refactor switch case for evaluators

    - use case X,Y instead of case X -> fallthrough -> case Y
    - former is cleaner than latter
    
    Signed-off-by: vadasambar <surajrbanakar@gmail.com>
    vadasambar authored and toddbaert committed Jan 3, 2023
    Configuration menu
    Copy the full SHA
    9e0dff0 View commit details
    Browse the repository at this point in the history
  15. docs: add extra wording around yaml evaluation

    Signed-off-by: vadasambar <surajrbanakar@gmail.com>
    vadasambar authored and toddbaert committed Jan 3, 2023
    Configuration menu
    Copy the full SHA
    4b079c3 View commit details
    Browse the repository at this point in the history
  16. fix: make lint failing

    Signed-off-by: vadasambar <surajrbanakar@gmail.com>
    vadasambar authored and toddbaert committed Jan 3, 2023
    Configuration menu
    Copy the full SHA
    ecd7eff View commit details
    Browse the repository at this point in the history