Skip to content

--output yaml prints testDate in scientific notation #644

Backlog

Description

@ankushkhakale

Describe the bug

When running microcks test with --output yaml, testDate (and any integer >= 1,000,000) is formatted in scientific notation instead of a plain integer:

  • --output json: "testDate": 1795635823307
  • --output yaml: testDate: 1.795635868754e+12

This makes --output yaml inconsistent with --output json and awkward for scripts or CI pipelines parsing testDate as an epoch millisecond integer.

Expected behavior

--output yaml should render testDate (and other integer fields) as plain integers, matching --output json.

Actual behavior

testDate is rendered as a scientific-notation float (1.795635868754e+12).

In pkg/output/yaml_formatter.go (lines 29–43), TestResult is marshaled to JSON, unmarshaled into interface{} (which decodes JSON numbers as float64), and then passed to gopkg.in/yaml.v3 (which formats float64 values >= 1,000,000 in scientific notation). TestYAMLFormatter in pkg/output/output_test.go leaves TestDate at 0, so this wasn't caught by existing tests.

How to Reproduce?

  1. Run a contract test with --output yaml using a sample OpenAPI spec:
    microcks test --dry-run --artifact ../microcks/samples/APIPastry-openapi.yaml 'API Pastry - 2.0:2.0.0' http://localhost:9090 OPEN_API_SCHEMA --output yaml
    

Microcks version or git rev

microcks-cli master (commit 830fc9b)

Install method (docker-compose, helm chart, operator, docker-desktop extension,...)

Built locally from source (make build-local with Go 1.27.4) + Docker 29.9.3

Additional information

  • OS: Ubuntu Linux (linux/amd64)
  • Happy to open a small PR to preserve integer formatting in YAML output and add a regression test with a realistic TestDate if this looks good to fix.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions