Skip to content

feat: add a chart value for the Swagger UI - #245

Merged
uniqueg merged 4 commits into
devfrom
feat/swagger-ui-value
Nov 6, 2026
Merged

uniqueg merged 4 commits into
devfrom
feat/swagger-ui-value

Conversation

@uniqueg

@uniqueg uniqueg commented Nov 6, 2026 •

Copy link
Copy Markdown
Member

Summary

tesk-api now serves the Swagger UI only if TESK_API_SWAGGER_UI_ENABLED is true (elixir-cloud-aai/tesk-api#80, from tesk-api 1.2.0), and stops at startup on anything but true or false. This adds the chart value tesk.swaggerUi.enabled, default false:

  • Passed to the API as TESK_API_SWAGGER_UI_ENABLED; null (for the value or tesk.swaggerUi) leaves the variable out, so tesk-api's default (off) applies.
  • Rendering fails on anything but true or false (booleans, or strings in any case, lowercased, for tools that set only strings) and on a non-map tesk.swaggerUi, rather than the API failing at startup.
  • Named after Helm's conventions (camelCase, an enabled toggle), like the planned renames of refactor: follow the Helm conventions in the chart #228; no existing value or resource changes.
  • Docs: configuration reference, deployment ("Swagger UI" section; the auth section now names the API description and the Swagger UI as public endpoints), API page, upgrade notes ("Upgrading the chart alone changes nothing" while the default tesk.image is 1.1.0). Wording: turning it on serves the Swagger UI publicly; enable it only where needed.

Closes #243

Verification

  • REQUIRE_HELM=1 coverage run -m pytest (helm 3.22.1): 79 passed; coverage 100%. The new tests failed before the template change.
  • helm lint --strict charts/tesk: passes.
  • mkdocs build --strict: passes.
  • ruff 0.17.3 (check, format), mypy: clean.

Review

Full review (chart logic): adversarial-reviewer and quality-reviewer, two rounds. Fixed: non-map tesk.swaggerUi silently ignored or failing with an unclear error; strings "true"/"false" now accepted; auth docs didn't name /v2/api-docs and the Swagger UI as public; OIDC paragraph had moved out of the auth section; upgrade note title and wording; Swagger UI path given as absolute instead of under ingress.path.

Declined review findings

  • Move the validation into a _helpers.tpl helper or values.schema.json: the chart has neither yet (refactor: follow the Helm conventions in the chart #228); one inline block is clearer until a second value needs the same check.
  • Say "needs tesk-api 1.2.0" in fewer places: each page is read on its own (reference table, deployment, upgrade notes, values comments); to revisit when the default tesk.image moves to 1.2.0.

Open questions

None.

🤖 Generated with Claude Code

Summary by Sourcery

Add an opt-in Helm setting for serving the Swagger UI with early validation and comprehensive documentation.

New Features:

  • Add the tesk.swaggerUi.enabled Helm value to control whether the API serves Swagger UI, defaulting to disabled.
  • Document Swagger UI exposure, authentication behavior, version compatibility, and upgrade considerations.

Bug Fixes:

  • Validate Swagger UI configuration during chart rendering so invalid values fail clearly instead of allowing the API to fail at startup.

Enhancements:

  • Pass valid boolean values to tesk-api while allowing case-insensitive string representations and preserving null defaults.
  • Clarify that the API description and enabled Swagger UI are public endpoints under authenticated deployments.

Documentation:

  • Update the configuration, deployment, API, and upgrade documentation for the Swagger UI setting and its public exposure.

Tests:

  • Add chart rendering coverage for default, enabled, disabled, null, string, and invalid Swagger UI values.

uniqueg and others added 3 commits November 6, 2026 16:40
tesk-api 1.2.0 serves the Swagger UI only if TESK_API_SWAGGER_UI_ENABLED
is true, and stops on anything but true or false. Add
tesk.swaggerUi.enabled (default false), passed on unless null, and
fail the rendering on non-boolean values. Document it in the
configuration reference, the deployment docs and the upgrade notes.

Closes #243

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Fail on a non-map tesk.swaggerUi, accept true and false as strings
(in any case) for tools that set only strings, and keep the OIDC
client paragraph in the auth section. Name the API description and
the Swagger UI as public endpoints with auth, and say that upgrading
the chart alone changes nothing before tesk-api 1.2.0.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Reflow the upgrade note, and give the Swagger UI's path as the root
path of the deployment (ingress.path) in the reference.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@sourcery-ai

sourcery-ai Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Reviewer's Guide

Adds the opt-in tesk.swaggerUi.enabled chart value, validates it during Helm rendering, conditionally passes it to tesk-api, and documents its public exposure and tesk-api version compatibility.

Sequence diagram for conditional Swagger UI configuration

sequenceDiagram
    participant User as Helm user
    participant Helm as Helm renderer
    participant API as tesk-api
    User->>Helm: helm install or helm upgrade
    alt valid true or false value
        Helm->>Helm: Render tesk-deployment.yaml
        Helm->>API: Set TESK_API_SWAGGER_UI_ENABLED
        API-->>Helm: Start with Swagger UI setting
    else null value
        Helm->>Helm: Render without environment variable
        Helm->>API: Start with default Swagger UI setting
    else invalid value
        Helm-->>User: Rendering fails before deployment
    end
Loading

Flow diagram for Swagger UI Helm value validation

flowchart TD
    A[Helm values: tesk.swaggerUi] --> B{tesk.swaggerUi is null or a map?}
    B -- No --> X[Helm rendering fails]
    B -- Yes --> C{enabled is null?}
    C -- Yes --> D[Omit TESK_API_SWAGGER_UI_ENABLED]
    C -- No --> E{Boolean or string true/false?}
    E -- No --> X
    E -- Yes --> F[Set TESK_API_SWAGGER_UI_ENABLED]
    D --> G[Deploy tesk-api]
    F --> G
    G --> H{API value is true?}
    H -- Yes --> I[Serve Swagger UI publicly]
    H -- No --> J[Swagger UI remains off]
Loading

File-Level Changes

Change Details Files
Adds an opt-in Helm value and translates it into the API environment variable with chart-side validation.
  • Introduces tesk.swaggerUi.enabled, defaulting to false.
  • Omits the environment variable for null values so the API default applies.
  • Accepts booleans and case-insensitive string forms of true/false, while rejecting invalid values and non-map tesk.swaggerUi configurations during rendering.
charts/tesk/templates/common/tesk-deployment.yaml
charts/tesk/values.yaml
Adds rendering tests covering Swagger UI configuration behavior and validation failures.
  • Verifies default, enabled, disabled, null, and string-valued configurations.
  • Verifies invalid strings, numbers, lists, and non-map parent values fail with a useful error.
tests/test_chart.py
Documents Swagger UI availability, public exposure, authentication behavior, and version compatibility.
  • Updates configuration and deployment references with the new setting and its validation rules.
  • Clarifies API description and Swagger UI public access under authenticated mode.
  • Adds API-page guidance and upgrade notes explaining the tesk-api 1.2.0 dependency and unchanged behavior when only the chart is upgraded.
docs/api.md
docs/configuration.md
docs/deployment.md
docs/upgrading.md

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@codecov

codecov Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (4a126d8) to head (b4b3be0).

Additional details and impacted files
@@            Coverage Diff            @@
##               dev      #245   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            1         1           
  Lines          199       199           
=========================================
  Hits           199       199           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@uniqueg
uniqueg marked this pull request as ready for review November 6, 2026 16:23

@sourcery-ai sourcery-ai Bot left a comment

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.

Hey - I've reviewed your changes and they look great!

Linked issues

#243 feat: add a chart value for the Swagger UI · 3 of 3 met

# Requirement Status Notes
1 Add a chart value for the Swagger UI, off by default, and pass it to the API as TESK_API_SWAGGER_UI_ENABLED. ✅ Met The chart defines tesk.swaggerUi.enabled as false and conditionally renders the environment variable; tests cover the default, explicit values, and null.
2 Reject values other than true and false when rendering. ✅ Met The template validates the value and fails rendering for invalid values, with tests covering invalid settings.
3 Document the setting in the configuration reference, deployment docs, and upgrade notes, including that enabling it serves the Swagger UI publicly and it should be enabled only where needed. ✅ Met All three requested docs are updated with the public-exposure warning.

Sourcery assessment

Approved.


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

@uniqueg
uniqueg merged commit a73a987 into dev Nov 6, 2026
21 checks passed
@uniqueg
uniqueg deleted the feat/swagger-ui-value branch November 6, 2026 16:28
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.

feat: add a chart value for the Swagger UI

1 participant