Skip to content

fix: Makes sure OpenApi schema required list is sorted#190

Merged
zachdaniel merged 1 commit intoash-project:mainfrom
sezaru:deterministic_required_list_order
Apr 23, 2026
Merged

fix: Makes sure OpenApi schema required list is sorted#190
zachdaniel merged 1 commit intoash-project:mainfrom
sezaru:deterministic_required_list_order

Conversation

@sezaru
Copy link
Copy Markdown
Contributor

@sezaru sezaru commented Apr 23, 2026

This is a very simple PR that basically guarantees that an OpenApi schema is always generated the exact same way if the inputs are the same.

Basically, the required list in the schema is not deterministic, since Map.keys() doesn't guarantee the order the data will output. This means that, if you call that function with the same input multiple times, there is no guarantee that it will output the list in the exact same order.

In my specific use case, this is a big issue because I have a cache system where one of the things I use as the key to the cache, is this schema. and since any required list inside the schema doesn't guarantee order, I was having a bunch of cache misses because of that.

This PR fixes that by sorting the list.

Since it is such a minor change, I didn't change any unit tests, I hope that is OK, but I can create some if needed.

Contributor checklist

Leave anything that you believe does not apply unchecked.

  • I accept the AI Policy, or AI was not used in the creation of this PR.
  • Bug fixes include regression tests
  • Chores
  • Documentation changes
  • Features include unit/acceptance tests
  • Refactoring
  • Update dependencies

@zachdaniel zachdaniel merged commit 045b873 into ash-project:main Apr 23, 2026
23 checks passed
@zachdaniel
Copy link
Copy Markdown
Contributor

🚀 Thank you for your contribution! 🚀

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 this pull request may close these issues.

2 participants