Performance issue with just one "oneOf" in the OpenAPI Spec

Issue #25 new
Shreyas Purohit created an issue

Please find attached a sample OpenAPI which produces performance issue. There is exactly one “oneOf” keyword used in the spec. Running the whole doc takes 24s.

❯ time openapi-diff ./docs/openapi.yaml ./docs/openapi.yaml
No changes found between the two specifications
openapi-diff ./docs/openapi.yaml ./docs/openapi.yaml  24.67s user 0.15s system 101% cpu 24.350 total

If I remove the attributes within the “oneOf” type PayloadV2, for example: externalId, externalIdChangedAt, externalIdChangedBy , the time to diff reduces to 0.9s.

❯ time openapi-diff ./docs/openapi.yaml ./docs/openapi.yaml
No changes found between the two specifications
openapi-diff ./docs/openapi.yaml ./docs/openapi.yaml  0.90s user 0.07s system 158% cpu 0.612 total

The higher the number of attributes within the “oneOf” type object, the slower it gets. Even adding 3-4 attributes in each of the types becomes incredibly slow. Some of our builds are taking 150+ seconds with just one “oneOf” keyword with two types in them.

Comments (0)

  1. Log in to comment