Skip to content

Commit

Permalink
Always add core version to the api spec
Browse files Browse the repository at this point in the history
This is supposed to help select proper bindings generator based on the
version of pulpcore used.
  • Loading branch information
mdellweg committed Dec 2, 2024
1 parent bd2624c commit f5ac084
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGES/+core_in_bindings_spec.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added core version to the bindings api spec even if core apis are not part of the spec.
6 changes: 6 additions & 0 deletions pulpcore/openapi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -420,10 +420,16 @@ def get_schema(self, request=None, public=False):
if request and "component" in request.query_params:
# /pulp/api/v3/docs/api.json?component=core,file
app_labels = request.query_params["component"].split(",")
if "core" not in app_labels:
core_app = [app for app in apps if app.label == "core"]
else:
core_app = []
apps = [app for app in apps if app.label in app_labels]
if len(apps) != len(app_labels):
raise ParseError("Invalid component specified.")
request.plugins = [app.name.split(".")[0] for app in apps]
# Adding core back because we want to report it's version too.
apps.extend(core_app)
request.apps = apps

request.bindings = "bindings" in request.query_params
Expand Down

0 comments on commit f5ac084

Please sign in to comment.