Skip to content

feat: add deck file format command for deck/dbless conversion#1978

Open
mheap wants to merge 1 commit intomainfrom
add-file-format-command
Open

feat: add deck file format command for deck/dbless conversion#1978
mheap wants to merge 1 commit intomainfrom
add-file-format-command

Conversation

@mheap
Copy link
Copy Markdown
Member

@mheap mheap commented Apr 7, 2026

Why

Ref: https://github.com/Kong/go-apiops/blob/main/deckformat/fileformat.md

Kong configuration files exist in two incompatible formats — decK (human-friendly, intended for manual editing) and DBless (Kong's backup/restore format, used with kong config db_export / kong config db_import). Users working across both toolchains need a way to convert between them without manual editing.

What

Adds a new deck file format subcommand:

deck file format deck /path/to/dbless.yaml    # DBless → decK
deck file format dbless /path/to/deck.yaml    # decK → DBless

Supports -o / --output-file (default: stdout) and --format yaml|json.

How

The two formats differ primarily in how consumer-group entities are represented:

Entity decK DBless
Group plugins nested under consumer_groups[*].plugins top-level consumer_group_plugins array
Group memberships nested under consumers[*].groups top-level consumer_group_consumers array
  • DBless → decK delegates to deckformat.ConvertDBless() from go-apiops, which already implements this transformation.
  • decK → DBless is implemented locally in convertDeckToDBless() as the inverse: it extracts nested plugins and group memberships back into top-level arrays, adding the appropriate consumer_group / consumer foreign-key fields.

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Apr 7, 2026

Codecov Report

❌ Patch coverage is 12.61261% with 97 lines in your changes missing coverage. Please review.
✅ Project coverage is 32.26%. Comparing base (6719b2a) to head (0d15c26).
⚠️ Report is 13 commits behind head on main.

Files with missing lines Patch % Lines
cmd/file_format.go 0.00% 96 Missing ⚠️
cmd/root.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1978      +/-   ##
==========================================
- Coverage   32.58%   32.26%   -0.32%     
==========================================
  Files          77       78       +1     
  Lines        6903     7014     +111     
==========================================
+ Hits         2249     2263      +14     
- Misses       4474     4571      +97     
  Partials      180      180              

☔ View full report in Codecov by Sentry.
📢 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.

@mheap mheap requested a review from Prashansa-K April 7, 2026 10:08
@mheap mheap force-pushed the add-file-format-command branch from 3fa0fe1 to 81b2253 Compare April 7, 2026 11:23
Adds a new 'deck file format' subcommand that converts Kong configuration
files between decK format and Kong DBless format.

Usage:
 decK
 DBless

The two formats differ in consumer-group entity representation:
- decK:   plugins nested under consumer_groups[*].plugins,
          memberships nested under consumers[*].groups
- DBless: plugins in top-level consumer_group_plugins array,
          memberships in top-level consumer_group_consumers array

 decK, delegates to deckformat.ConvertDBless from go-apiops.
 DBless, implements the inverse transformation locally.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@mheap mheap added skip-konnect Skip Konnect Integration tests in CI skip-ee Skip Enterprise Integration Tests in CI skip-oss Skip Open Source Integration Tests in CI labels Apr 8, 2026
@mheap mheap force-pushed the add-file-format-command branch from 81b2253 to 0d15c26 Compare April 8, 2026 12:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-ee Skip Enterprise Integration Tests in CI skip-konnect Skip Konnect Integration tests in CI skip-oss Skip Open Source Integration Tests in CI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants