opticdev / optic

OpenAPI linting, diffing and testing. Optic helps prevent breaking changes, publish accurate documentation and improve the design of your APIs.
https://useoptic.com
MIT License
1.35k stars 79 forks source link

Order capture patch summaries #2677

Closed niclim closed 8 months ago

niclim commented 8 months ago

🍗 Description

What does this PR do? Anything folks should know?

I noticed that node20 tests were being flaky, particularly around optic capture outputs. Not sure why node 20 specifically had differnet outputs, but I realized that patches were being summarized in the order the interactions happened, meaning we could have out of order patch summaries... E.g.

POST /form
  × Request Body
  # Here 200 response body comes between the request bodies
  [200 response body] body is not documented
  [request body] 'name' is not documented (/properties)
  [request body] 'surname' is not documented (/properties)

This PR orders the patch summaries so that we list them by request, then response (sorted by status code ascending)

📚 References

Links to relevant docs (Notion, Twist, GH issues, etc.), if applicable.

👹 QA

How can other humans verify that this PR is correct?