mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-10-03 19:57:35 +00:00
feat(api): oasdiff OpenAI openAPI spec against ours
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 <cdoern@redhat.com>
This commit is contained in:
parent
a09e30bd87
commit
d9abb2e958
1 changed files with 34 additions and 0 deletions
34
.github/workflows/conformance.yml
vendored
34
.github/workflows/conformance.yml
vendored
|
@ -65,6 +65,15 @@ jobs:
|
||||||
ref: ${{ github.event.pull_request.base.ref }}
|
ref: ${{ github.event.pull_request.base.ref }}
|
||||||
path: 'base'
|
path: 'base'
|
||||||
|
|
||||||
|
|
||||||
|
# Cache openai spec
|
||||||
|
- name: Cache openai openapi spec
|
||||||
|
id: cache-openapi
|
||||||
|
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809
|
||||||
|
with:
|
||||||
|
path: ~/openai-openapi
|
||||||
|
key: openai-openapi.yml
|
||||||
|
|
||||||
# Cache oasdiff to avoid checksum failures and speed up builds
|
# Cache oasdiff to avoid checksum failures and speed up builds
|
||||||
- name: Cache oasdiff
|
- name: Cache oasdiff
|
||||||
if: steps.skip-check.outputs.skip != 'true'
|
if: steps.skip-check.outputs.skip != 'true'
|
||||||
|
@ -81,6 +90,12 @@ jobs:
|
||||||
curl -fsSL https://raw.githubusercontent.com/oasdiff/oasdiff/main/install.sh | sh
|
curl -fsSL https://raw.githubusercontent.com/oasdiff/oasdiff/main/install.sh | sh
|
||||||
cp /usr/local/bin/oasdiff ~/oasdiff
|
cp /usr/local/bin/oasdiff ~/oasdiff
|
||||||
|
|
||||||
|
- name: Get openai openapi spec
|
||||||
|
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
|
||||||
|
|
||||||
# Setup cached oasdiff
|
# Setup cached oasdiff
|
||||||
- name: Setup cached oasdiff
|
- name: Setup cached oasdiff
|
||||||
if: steps.skip-check.outputs.skip != 'true' && steps.cache-oasdiff.outputs.cache-hit == 'true'
|
if: steps.skip-check.outputs.skip != 'true' && steps.cache-oasdiff.outputs.cache-hit == 'true'
|
||||||
|
@ -137,6 +152,25 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
oasdiff breaking --fail-on ERR $BASE_SPEC $CURRENT_SPEC --match-path '^/v1/'
|
oasdiff breaking --fail-on ERR $BASE_SPEC $CURRENT_SPEC --match-path '^/v1/'
|
||||||
|
|
||||||
|
# Run oasdiff to detect breaking changes in the API specification when compared to the OpenAI openAPI spec
|
||||||
|
- name: Run OpenAPI Breaking Change Diff Against OpenAI API
|
||||||
|
if: steps.skip-check.outputs.skip != 'true'
|
||||||
|
continue-on-error: true
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
OPENAI_SPEC=~/openai-openapi/openai-openapi.yml
|
||||||
|
LOCAL_SPEC=docs/static/llama-stack-spec.yaml
|
||||||
|
|
||||||
|
# Compare OpenAI spec against Llama Stack spec
|
||||||
|
# Strip /v1 prefix from our spec to match OpenAI's paths
|
||||||
|
# Filter out api-path-removed errors for OpenAI routes we don't implement
|
||||||
|
oasdiff breaking --fail-on ERR \
|
||||||
|
"$OPENAI_SPEC" \
|
||||||
|
"$LOCAL_SPEC" \
|
||||||
|
--strip-prefix-revision "/v1" 2>&1 | \
|
||||||
|
grep -v "api-path-removed-without-deprecation" | \
|
||||||
|
grep -v "api-removed-without-deprecation" || true
|
||||||
|
|
||||||
# Report when test is skipped
|
# Report when test is skipped
|
||||||
- name: Report skip reason
|
- name: Report skip reason
|
||||||
if: steps.skip-check.outputs.skip == 'true'
|
if: steps.skip-check.outputs.skip == 'true'
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue