Skip to content

Conversation

cdoern
Copy link
Contributor

@cdoern cdoern commented Sep 23, 2025

What does this PR do?

diff the /v1/openai/v1 routes against the OpenAI openAPI spec. This will of course only trigger on PRs where the spec is changed.

This will catch errors with new handwritten additions to our openAI compat routes.

I am marking this test with continue-on-error: true, until we get rid of all of the errors. Nevertheless, this is a nice utility to have so folks know if their spec changes introduce more breaking changes or fix breakages when comparing to the OpenAI openapi spec.

Test Plan

test should pass.

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Meta Open Source bot. label Sep 23, 2025
@cdoern cdoern force-pushed the oasdiff-for-openai branch 10 times, most recently from 67b7c6e to b509e85 Compare September 24, 2025 14:49
@cdoern cdoern marked this pull request as ready for review September 24, 2025 14:51
"$OPENAI_SPEC" \
"$LOCAL_SPEC" \
--strip-prefix-revision "/v1/openai/v1" \
--match-path "(^/v1/openai/v1)?/(chat/completions|completions|embeddings|files|models|moderations|vector_stores|responses)(/.*)?$"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should probably have this list in code or as annotations to the specific apis in the code instead of listing the paths here: (^/v1/openai/v1)?/(chat/completions|completions|embeddings|files|models|moderations|vector_stores|responses)

if: steps.cache-openapi.outputs.cache-hit != 'true'
run: |
mkdir -p ~/openai-openapi
curl -L https://app.stainless.com/api/spec/documented/openai/openapi.documented.yml -o ~/openai-openapi/openai-openapi.yml
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we not want to pin the version of the openai api?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, I can pin it. Do we have a version in mind we want to use?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the pinning is important, what's the latest version so we can get started with it?

id: cache-openapi
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809
with:
path: ~/openai-openapi
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why use ~ here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe the cache action by default has access only to a runners home dir? I could be wrong but that is where I have been storing and writing the cached binaries+files to/from

key: openai-openapi.yml

# Cache oasdiff to avoid checksum failures and speed up builds
- name: Cache oasdiff
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should probably also support a force no-cache conformance check as well - we should probably run it at the time of release.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, but should I make this a separate action so it can be triggered by maintainers manually?

@cdoern cdoern force-pushed the oasdiff-for-openai branch 4 times, most recently from da078af to c5bd55e Compare September 27, 2025 19:19
@cdoern cdoern requested a review from raghotham September 27, 2025 19:20
Copy link
Collaborator

@leseb leseb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this action could result in a "badge" on the repo once we feel confident, having the compatibility ratio again openai is very important :)

@cdoern cdoern force-pushed the oasdiff-for-openai branch 3 times, most recently from d7e8b77 to 5e68691 Compare October 3, 2025 15:52
@cdoern
Copy link
Contributor Author

cdoern commented Oct 3, 2025

this now checks all of our APIs against all of the openAI apis. The removal of /v1/openai/v1/ makes this kind of difficult

@cdoern cdoern force-pushed the oasdiff-for-openai branch from 5e68691 to f423104 Compare October 3, 2025 16:11
diff the `/v1/` routes that are OpenAI compatible against the OpenAI openAPI spec. This will of course only trigger on PRs where the spec is changed.

This will catch errors with new handwritten additions to our openAI compat routes.

Signed-off-by: Charlie Doern <[email protected]>
@cdoern cdoern force-pushed the oasdiff-for-openai branch from f423104 to d9abb2e Compare October 3, 2025 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants