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

Incorrectly flattens arrays-of-arrays in freeform fields #43

Closed
eropple opened this issue Jun 10, 2022 · 2 comments · Fixed by #45
Closed

Incorrectly flattens arrays-of-arrays in freeform fields #43

eropple opened this issue Jun 10, 2022 · 2 comments · Fixed by #45

Comments

@eropple
Copy link

eropple commented Jun 10, 2022

Hey there! Been noodling with openapi-merger, it's a real help. Ran into a bug, though. If you have an example field (which is, by spec, freeform and should generally just be ignored), the merge logic in the library recurses down into it and seems to flatten arrays-of-arrays.

Example from a source file:

          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/GetMetricTimeseriesDataResponse"
              example:
                total_row_count: 2
                timeframe:
                  - 1610029711
                  - 1610116111
                meta:
                  aggregation: "view_end"
                data:
                  - - '2021-01-07T14:00:00Z'
                    - '0.8743536882994202'
                    - '154240'
                  - - '2021-01-07T15:00:00Z'
                    - '0.8929105055911401'
                    - '156056'

And the result from a build that incorporates this file:

      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetMetricTimeseriesDataResponse'
              example:
                total_row_count: 2
                timeframe:
                  - 1610029711
                  - 1610116111
                meta:
                  aggregation: view_end
                data:
                  - '2021-01-07T14:00:00Z'
                  - '0.8743536882994202'
                  - '154240'
                  - '2021-01-07T15:00:00Z'
                  - '0.8929105055911401'
                  - '156056'

My temporary solution is in this branch and it unblocks my problem, but I'm sure it's not a complete solution.

Anyway, thanks for the library! Hope this helps improve it.

@kota65535
Copy link
Owner

@eropple fixed in 0.5.4, please try it.

@kota65535
Copy link
Owner

I've also added a usage in case of not merging arrays in README, hope this helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants