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

bugfix: API: encode empty Vector/Matrix as [] not null #13997

Merged
merged 7 commits into from
Apr 29, 2024

Commits on Apr 29, 2024

  1. tests: API: simplify check of error response

    Since we already use require.JSONEq in similar cases.
    
    Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
    bboreham committed Apr 29, 2024
    Configuration menu
    Copy the full SHA
    2c4a363 View commit details
    Browse the repository at this point in the history
  2. tests: API: Use jsoniter when encoding

    So that tests use the same encoding as the api.
    
    Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
    bboreham committed Apr 29, 2024
    Configuration menu
    Copy the full SHA
    5a339ba View commit details
    Browse the repository at this point in the history
  3. tests: API: Let nil expected response mean skip check

    When we want to check just the json encoding.
    
    Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
    bboreham committed Apr 29, 2024
    Configuration menu
    Copy the full SHA
    c8aed6b View commit details
    Browse the repository at this point in the history
  4. refactor: API: be explicit that we marshal empty objects

    Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
    bboreham committed Apr 29, 2024
    Configuration menu
    Copy the full SHA
    66a1c3d View commit details
    Browse the repository at this point in the history
  5. refactor: API: separate typed and unsafe marshalling

    The typed versions are used when we call from one marshaller to another.
    
    Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
    bboreham committed Apr 29, 2024
    Configuration menu
    Copy the full SHA
    e0a00f4 View commit details
    Browse the repository at this point in the history
  6. test: API: check empty responses

    Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
    bboreham committed Apr 29, 2024
    Configuration menu
    Copy the full SHA
    00247b5 View commit details
    Browse the repository at this point in the history
  7. bugfix: API: encode empty Vector/Matrix as []

    If the underlying data is `nil` the default encoding
    will render `"null"` which is not accepted by
    (some) Prometheus client libraries.
    
    Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
    bboreham committed Apr 29, 2024
    Configuration menu
    Copy the full SHA
    5c8ffaa View commit details
    Browse the repository at this point in the history