Skip to content

feat: fetch openapi.yaml file from release assets#49

Merged
NicolasCARPi merged 2 commits intomasterfrom
nico-260306-fetchyaml
Mar 6, 2026
Merged

feat: fetch openapi.yaml file from release assets#49
NicolasCARPi merged 2 commits intomasterfrom
nico-260306-fetchyaml

Conversation

@NicolasCARPi
Copy link
Copy Markdown
Contributor

@NicolasCARPi NicolasCARPi commented Mar 6, 2026

Summary by CodeRabbit

Refactor

  • OpenAPI specification is now fetched dynamically from the latest release assets instead of a hardcoded source.
  • Generation steps (all modes) now use the dynamically obtained spec URL.
  • Added validation to stop the process if the required asset URL is missing, improving reliability.
  • Cleanup continues to run before generation with the updated dynamic workflow.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 6, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f2d46cfd-5240-4658-86ac-18a0ed891e42

📥 Commits

Reviewing files that changed from the base of the PR and between 72078f0 and 483506f.

📒 Files selected for processing (1)
  • helper.sh
🚧 Files skipped from review as they are similar to previous changes (1)
  • helper.sh

Walkthrough

The helper.sh script now dynamically retrieves the OpenAPI specification browser_download_url from the latest GitHub release assets via the GitHub API (curl + jq), validates the result, and uses that URL for all subsequent docker-based generation steps.

Changes

Cohort / File(s) Summary
OpenAPI release retrieval
helper.sh
Replaced hardcoded openapi_yaml_url with dynamic GitHub release asset lookup (gh_api_release_urlbrowser_url) using curl/jq; added validation to error out if URL missing; updated all docker run generation commands to use browser_url; kept cleanup invocation before generation.

Sequence Diagram(s)

sequenceDiagram
  participant Script as helper.sh
  participant GitHub as GitHub API
  participant Docker as openapi-generator (docker)

  Script->>GitHub: GET latest release assets (curl)
  GitHub-->>Script: JSON with assets (includes browser_download_url)
  Script->>Script: extract browser_url (jq) and validate
  alt browser_url present
    Script->>Docker: invoke generator with browser_url (generate,generate-html,generate-ci)
    Docker-->>Script: generation output
  else missing browser_url
    Script-->>Script: exit with error
  end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

Make it so: the YAML sails anew,
From GitHub's vault the browser link we view,
Curl and jq fetch the map with care,
Docker follows — generation there,
A tidy course, dynamic and true.

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main change: implementing dynamic retrieval of openapi.yaml from GitHub release assets instead of hardcoded URLs.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch nico-260306-fetchyaml

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@helper.sh`:
- Around line 32-36: The GitHub API call using the curl invocation (the curl ...
"$url" | jq ... pipeline) lacks timeouts and retries; add defensive network
bounds by updating the curl invocation to include options like --fail,
--connect-timeout (e.g., 5s), --max-time (e.g., 30s), and retry flags such as
--retry (e.g., 3), --retry-delay (e.g., 2) and optionally --retry-connrefused so
the call to "$url" will fail fast and retry transient failures before handing
the result to jq.
- Around line 31-36: The curl call that populates browser_url is using an
undefined variable "$url"; change the curl invocation to use the existing
gh_api_release_url variable instead so browser_url is fetched from
gh_api_release_url; update the reference in the browser_url assignment (where
curl is invoked) to pass gh_api_release_url to curl so the subsequent validation
of browser_url succeeds.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b643161d-05ff-45e1-b064-1a0afeaa4915

📥 Commits

Reviewing files that changed from the base of the PR and between 1568942 and 72078f0.

📒 Files selected for processing (1)
  • helper.sh

Comment thread helper.sh
Comment thread helper.sh
@NicolasCARPi NicolasCARPi merged commit 7560027 into master Mar 6, 2026
2 checks passed
@NicolasCARPi NicolasCARPi deleted the nico-260306-fetchyaml branch March 6, 2026 15:38
NicolasCARPi added a commit that referenced this pull request Mar 6, 2026
* 'master' of github.com:elabftw/elabapi-python:
  examples: JSON-ify 'metadata' explicitly (#48)
  feat: fetch openapi.yaml file from release assets (#49)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant