Skip to content

fix: regenerate OpenAPI specs from Go types, add jobConfig/jobScript and correct HTTP methods#499

Open
Copilot wants to merge 9 commits intomainfrom
copilot/update-to-v0-5-6
Open

fix: regenerate OpenAPI specs from Go types, add jobConfig/jobScript and correct HTTP methods#499
Copilot wants to merge 9 commits intomainfrom
copilot/update-to-v0-5-6

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 25, 2026

plugin-openapi.json was manually maintained and stuck at v0.4.0, causing the /create endpoint's request schema (RetrievedPodData) to be missing the jobConfig (ScriptBuildConfig) and jobScript fields that interLink actually sends to plugins. Additionally, several endpoints had incorrect HTTP methods documented.

Changes

  • cmd/openapi-gen/main.go

    • Split into generateInterlinkSpec() + generatePluginSpec() — generator now produces both JSON files from Go types
    • Default version bumped 0.4.00.6.0
    • Fix: interLink API /create response was typed as RetrievedPodData; corrected to CreateStruct (what plugins return and interLink proxies to the VK)
    • Plugin spec uses RetrievedPodData as the /create request body, which carries jobConfig and jobScript
    • /status corrected to GET in both interLink and plugin specs (matches actual client code)
    • /getLogs corrected to GET with text/plain response in both specs (matches actual streaming behaviour)
    • /delete corrected to DELETE in the interLink spec (VK calls DELETE); plugin spec keeps POST
    • requestBody.required: true set for all POST endpoints that require a body (/create in both specs; /delete in the plugin spec), using a withRequiredBody helper that hooks into the Customize callback
  • docs/openapi/plugin-openapi.json — regenerated; /create request body now includes:

    {
      "pod": { ... },
      "container": [ ... ],
      "jobConfig": { "SingularityHubProxy": {...}, "ApptainerOptions": {...}, "Volumes": {...} },
      "jobScript": "..."
    }
  • docs/openapi/interlink-openapi.json — regenerated at v0.6.0 with corrected /create response type, correct HTTP methods throughout, and requestBody.required: true on /create

  • docs/openapi/GENERATING.md — new file documenting both specs, their endpoint tables (with correct HTTP methods), and how to keep them in sync (make openapi); Markdown tables use a single leading | and the Makefile snippet uses correct TAB indentation

Original prompt

This section details on the original issue you should resolve

<issue_title>Please update to v0.5 (or even 0.6)</issue_title>
<issue_description>While deploying a new setup, I found the docs outdated in terms of signature for the /create endpoint.

https://github.com/interlink-hq/interLink/blob/75253b484a35e3fc6d9baf0b543e0890c16e8a0e/docs/openapi/plugin-openapi.json#L779C1-L788C12

You may want to include the jsonConfig key.</issue_description>

<agent_instructions>please, in addition to that, create scripts and a .md on how to generate those api specs</agent_instructions>

Comments on the Issue (you are @copilot in this section)

@dciangot Ciao @landerlini , what do you mean by jsonConfig key here?

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@netlify
Copy link
Copy Markdown

netlify bot commented Mar 25, 2026

Deploy Preview for interlink-dev ready!

Name Link
🔨 Latest commit e08b607
🔍 Latest deploy log https://app.netlify.com/projects/interlink-dev/deploys/69c43df8317c8f0008a7c527
😎 Deploy Preview https://deploy-preview-499--interlink-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

…elds

- Extend cmd/openapi-gen/main.go to generate both interlink-openapi.json
  and plugin-openapi.json from Go types (was only generating interlink spec)
- Bump default version from 0.4.0 to 0.6.0 in generator
- Fix interLink API /create response type: RetrievedPodData → CreateStruct
- Add generatePluginSpec() producing plugin-openapi.json with correct
  RetrievedPodData schema including jobConfig and jobScript fields
- Regenerate both JSON specs
- Add docs/openapi/GENERATING.md documenting how to regenerate the specs

Co-authored-by: dciangot <4144326+dciangot@users.noreply.github.com>
Agent-Logs-Url: https://github.com/interlink-hq/interLink/sessions/f924d1c2-df66-4086-a403-d5eb0bf80d06
Copilot AI changed the title [WIP] Update docs for /create endpoint to include jsonConfig key fix: regenerate OpenAPI specs from Go types, add jobConfig/jobScript to plugin /create schema Mar 25, 2026
Copilot AI requested a review from dciangot March 25, 2026 13:38
@dciangot dciangot marked this pull request as ready for review March 25, 2026 13:40
Copilot AI review requested due to automatic review settings March 25, 2026 13:40
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates interLink’s OpenAPI documentation by switching spec generation to be derived from Go types (rather than manually maintained), and regenerates both the interLink server API spec and the plugin API spec to include newer request/response shapes (notably jobConfig/jobScript in the plugin /create request).

Changes:

  • Refactors cmd/openapi-gen/main.go to generate both interLink and plugin OpenAPI specs, bumps default spec version to 0.6.0, and corrects interLink /create response typing.
  • Regenerates docs/openapi/interlink-openapi.json and docs/openapi/plugin-openapi.json.
  • Adds docs/openapi/GENERATING.md documenting how to regenerate the specs.

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
cmd/openapi-gen/main.go Splits spec generation into interLink vs plugin, bumps default version, and updates schema types for /create.
docs/openapi/plugin-openapi.json Regenerated plugin API spec; /create request now includes jobConfig and jobScript.
docs/openapi/interlink-openapi.json Regenerated interLink server API spec at 0.6.0 with corrected /create response type.
docs/openapi/GENERATING.md New docs explaining the two specs and how to regenerate them.
ci/go.mod Removes require blocks (and ci/go.sum is emptied in this PR).
Comments suppressed due to low confidence (1)

ci/go.mod:12

  • ci/go.mod removed all require directives and ci/go.sum was emptied. If the Dagger module (including generated internal/dagger code) still depends on external modules, this will force dependency resolution at runtime and may break builds that run with -mod=readonly or rely on pinned sums. Please verify dagger call -m ./ci ... still works without modifying go.mod/go.sum, or re-add the required dependencies and sums via go mod tidy in ci/.
module dagger/interlink

go 1.24.0

replace go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc => go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.14.0

replace go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp => go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.14.0

replace go.opentelemetry.io/otel/log => go.opentelemetry.io/otel/log v0.14.0

replace go.opentelemetry.io/otel/sdk/log => go.opentelemetry.io/otel/sdk/log v0.14.0


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

dciangot and others added 4 commits March 25, 2026 20:44
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Diego Ciangottini <diego.ciangottini@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Diego Ciangottini <diego.ciangottini@gmail.com>
…ogs, DELETE for /delete)

- /status: POST → GET in both interLink and plugin specs
- /getLogs: POST → GET in both specs; response content type → text/plain
- /delete: POST → DELETE in interLink spec (VK uses DELETE; plugin spec keeps POST)
- GENERATING.md: fix method tables and Makefile TAB indentation
- Regenerate both JSON specs

Co-authored-by: dciangot <4144326+dciangot@users.noreply.github.com>
Agent-Logs-Url: https://github.com/interlink-hq/interLink/sessions/ba60a74d-3a23-4f5a-91b7-c803e7e417e9
Copilot AI changed the title fix: regenerate OpenAPI specs from Go types, add jobConfig/jobScript to plugin /create schema fix: regenerate OpenAPI specs from Go types, add jobConfig/jobScript and correct HTTP methods Mar 25, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 7 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

// server communication and writes it to ./docs/openapi/interlink-openapi.json.
func generateInterlinkSpec(version string) {
reflector := openapi3.Reflector{}
reflector.Spec = &openapi3.Spec{Openapi: "3.0.3"}
Copy link

Copilot AI Mar 25, 2026

Choose a reason for hiding this comment

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

OpenAPI 3.0.3 is a poor fit for this API because several endpoints use JSON request bodies with GET/DELETE. Many OpenAPI 3.0 consumers omit/ignore request bodies for those methods, and the regenerated specs end up dropping the request schema for /status, /getLogs, and /delete even though the runtime sends/reads JSON bodies. Consider emitting OpenAPI 3.1.0 (or remodeling those endpoints) so the request contracts are actually captured.

Suggested change
reflector.Spec = &openapi3.Spec{Openapi: "3.0.3"}
reflector.Spec = &openapi3.Spec{Openapi: "3.1.0"}

Copilot uses AI. Check for mistakes.
Comment on lines +98 to +101
reflector := openapi3.Reflector{}
reflector.Spec = &openapi3.Spec{Openapi: "3.0.3"}
reflector.Spec.Info.
WithTitle("interLink Plugin API").
Copy link

Copilot AI Mar 25, 2026

Choose a reason for hiding this comment

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

Same OpenAPI version issue for the plugin spec: with Openapi: "3.0.3", the generated spec currently has no request schema for /status and /getLogs even though interLink sends JSON bodies in those GET requests. Switching to OpenAPI 3.1.0 (or remodeling the endpoints) would allow the spec to represent the actual request payloads.

Copilot uses AI. Check for mistakes.
@@ -2,46 +2,6 @@ module dagger/interlink

go 1.24.0

Copy link

Copilot AI Mar 25, 2026

Choose a reason for hiding this comment

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

ci/go.mod now has only replace directives and no require block, and ci/go.sum is empty. Since this module depends on generated Dagger Go SDK code (ci/.gitignore ignores internal/dagger, etc.), builds can become non-reproducible or fail under -mod=readonly once the generated code imports external modules. Consider regenerating the Dagger SDK and committing the resulting go.mod/go.sum requirements (or documenting why deps should be unpinned).

Suggested change
require (
go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.14.0
go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.14.0
go.opentelemetry.io/otel/log v0.14.0
go.opentelemetry.io/otel/sdk/log v0.14.0
)

Copilot uses AI. Check for mistakes.
Comment on lines +44 to +48
| Endpoint | Method | Request type | Response type |
|---|---|---|---|
| `/create` | POST | `PodCreateRequests` | `CreateStruct` |
| `/delete` | DELETE | `v1.Pod` | — |
| `/pinglink` | POST | — | — |
Copy link

Copilot AI Mar 25, 2026

Choose a reason for hiding this comment

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

The table documents /status and /getLogs as GET requests with JSON request types, but the generated OpenAPI 3.0.3 specs currently contain no request schema for these endpoints (many OpenAPI 3.0 tools omit/ignore GET request bodies). Either document this caveat here (GET-with-body is non-standard) or switch the specs to OpenAPI 3.1.0 / remodel the endpoints so the request payloads are represented.

Copilot uses AI. Check for mistakes.
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.

Please update to v0.5 (or even 0.6)

3 participants