Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ write-available-featuresets:

.PHONY: clean
clean:
rm -f render write-available-featuresets models-schema
rm -f render write-available-featuresets
rm -rf tools/_output

VERSION ?= $(shell git describe --always --abbrev=7)
Expand Down
7 changes: 2 additions & 5 deletions hack/update-openapi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,5 @@ source "$(dirname "${BASH_SOURCE}")/lib/init.sh"
output_path="${OUTPUT_PATH:-openapi}"
output_package="${SCRIPT_ROOT}/${output_path}"

GENERATOR=openapi EXTRA_ARGS=--openapi:output-package-path=${output_path}/generated_openapi ${SCRIPT_ROOT}/hack/update-codegen.sh

go build github.com/openshift/api/openapi/cmd/models-schema

./models-schema | jq '.' > ${output_package}/openapi.json
# Generate both Go and JSON OpenAPI schemas using the integrated codegen tool
GENERATOR=openapi EXTRA_ARGS=--openapi:output-package-path=${output_path} ${SCRIPT_ROOT}/hack/update-codegen.sh

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

Quote the script path invocation.

Line 10 leaves ${SCRIPT_ROOT} unquoted when invoking hack/update-codegen.sh, so checkouts under paths with spaces can fail before codegen starts.

Proposed fix
-GENERATOR=openapi EXTRA_ARGS=--openapi:output-package-path=${output_path} ${SCRIPT_ROOT}/hack/update-codegen.sh
+GENERATOR=openapi EXTRA_ARGS=--openapi:output-package-path=${output_path} "${SCRIPT_ROOT}/hack/update-codegen.sh"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
GENERATOR=openapi EXTRA_ARGS=--openapi:output-package-path=${output_path} ${SCRIPT_ROOT}/hack/update-codegen.sh
GENERATOR=openapi EXTRA_ARGS=--openapi:output-package-path=${output_path} "${SCRIPT_ROOT}/hack/update-codegen.sh"
🧰 Tools
🪛 Shellcheck (0.11.0)

[info] 10-10: Double quote to prevent globbing and word splitting.

(SC2086)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@hack/update-openapi.sh` at line 10, The script invocation in the
update-openapi flow leaves the ${SCRIPT_ROOT} path expansion unquoted, which can
break when the checkout path contains spaces. Update the call in
hack/update-openapi.sh so the hack/update-codegen.sh path is quoted while
keeping the existing GENERATOR/openapi and EXTRA_ARGS behavior intact.

Source: Linters/SAST tools

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

While unlikely to be a major issue, this seems like a reasonable change to make while we are here.

I wouldn't block on this though.

76 changes: 0 additions & 76 deletions openapi/cmd/models-schema/main.go

This file was deleted.

Loading