Skip to content

Fix #437: unpin openapi-spec-validator and fix ximportresources OpenAPI paths#464

Merged
duglin merged 1 commit into
xregistry:mainfrom
clemensv:clemensv/issue437
May 20, 2026
Merged

Fix #437: unpin openapi-spec-validator and fix ximportresources OpenAPI paths#464
duglin merged 1 commit into
xregistry:mainfrom
clemensv:clemensv/issue437

Conversation

@clemensv

Copy link
Copy Markdown
Contributor

Fixes #437.

Issue

The pin openapi-spec-validator==0.8.0 in tools/requirements.txt was in place because anything higher broke the test suite. Investigation showed the newer versions weren't actually broken — they were correctly catching pre-existing bugs in tools/schema-generator.py that the older release silently let through.

With openapi-spec-validator>=0.8.1 (current latest: 0.8.5), the OpenAPI path-parameter resolution check raises:

openapi_spec_validator.validation.exceptions.UnresolvableParameterError:
  Path parameter 'resourceid' for 'get' operation in
  '/endpoints/{groupid}/messages/meta' was not resolved

Root cause

In generate_openapi(...), the loops that emit paths for a group's own resources correctly include {resourceid} in the URL template. The mirrored loops for ximportresources (resources imported from another group) were dropping the {resourceid} segment for four templates, producing paths whose operations referenced an undefined path parameter:

Template Before (broken) After (fixed)
meta /{group}/{groupid}/{ximpres}/meta /{group}/{groupid}/{ximpres}/{resourceid}/meta
$details /{group}/{groupid}/{ximpres}$details /{group}/{groupid}/{ximpres}/{resourceid}$details
versions /{group}/{groupid}/{ximpres}/versions /{group}/{groupid}/{ximpres}/{resourceid}/versions
versions/{versionid} /{group}/{groupid}/{ximpres}/versions/{versionid} /{group}/{groupid}/{ximpres}/{resourceid}/versions/{versionid}

The non-imported resources branches already had the correct URLs; the bug only affected the ximportresources branches.

Fix

  • tools/schema-generator.py: add the missing {resourceid} segment to the four ximportresources path templates so the emitted OpenAPI documents are valid.
  • tools/requirements.txt: replace openapi-spec-validator==0.8.0 with openapi-spec-validator>=0.7.1, allowing the latest validator.

Validation

python -m pytest test_schema_generator.py against openapi-spec-validator==0.8.5: 22 passed.

@clemensv
clemensv force-pushed the clemensv/issue437 branch 2 times, most recently from eac2316 to eadbc6f Compare May 18, 2026 15:39
…ces OpenAPI paths

The pin to openapi-spec-validator==0.8.0 was masking real bugs in schema-generator.py. The newer validator's path-parameter resolution check exposed four OpenAPI paths generated for ximportresources that were missing the {resourceid} segment (meta, $details, versions, and versions/{versionid}). Fixed those paths and unpinned the dependency to >=0.7.1.

Signed-off-by: Clemens Vasters <clemensv@microsoft.com>
@clemensv
clemensv force-pushed the clemensv/issue437 branch from eadbc6f to 03e7d5c Compare May 18, 2026 15:39
@duglin

duglin commented May 20, 2026

Copy link
Copy Markdown
Contributor

Approved on 5/20 call

@duglin
duglin merged commit a3de91e into xregistry:main May 20, 2026
2 checks passed
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.

anything higher than openapi-spec-validator==0.8.0 breaks us

2 participants