Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

docs: group enumerated values by property in API docs#21372

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
mtojek merged 6 commits intomainfromenums-1
Dec 22, 2025
Merged

Conversation

@mtojek
Copy link
Member

Description

This change modifies how enumerated values are displayed in the API documentation tables. Instead of creating a separate row for each enum value, values are now grouped by property name and displayed as comma-separated lists in a single row.

Before:

PropertyValue
login_typepassword
login_typegithub
login_typeoidc
login_typetoken

After:

PropertyValue(s)
login_typepassword,github,oidc,token

This significantly reduces the height of enum tables, especially for types with many possible values likecodersdk.APIKeyScope (which had 180+ individual rows before this change).

Changes

  • AddedgroupEnumsByName() function tomain.dot template that groups enum entries by property name
  • Updated enum rendering inmain.dot,responses.def, andparameters.def to use the new grouped structure
  • Changed header from "Value" to "Value(s)" to reflect that multiple values may be present
  • Regenerated all API documentation

Stats

The change results in a net reduction of ~1,100 lines in the documentation:

  • 3,762 lines removed
  • 2,675 lines added

Fixes#13840

This change modifies how enumerated values are displayed in the APIdocumentation tables. Instead of creating a separate row for each enumvalue, values are now grouped by property name and displayed ascomma-separated lists in a single row.Before:| Property     | Value     ||--------------|-----------|| `login_type` | `password` || `login_type` | `github`   || `login_type` | `oidc`     |After:| Property     | Value(s)                        ||--------------|---------------------------------|| `login_type` | `password`, `github`, `oidc` |This significantly reduces the height of enum tables, especially fortypes with many possible values like `codersdk.APIKeyScope`.Changes:- Added `groupEnumsByName()` function to main.dot template- Updated enum rendering in main.dot, responses.def, and parameters.def- Header changed from 'Value' to 'Value(s)' to reflect grouping- Regenerated all API documentationFixes#13840
@mtojekmtojek marked this pull request as draftDecember 22, 2025 13:54
Sort enum values within each property group for consistent orderingin the API documentation tables.
Remove duplicate enum values that appeared when the same propertyhad enum values defined in multiple places in the schema.
@mtojekmtojek marked this pull request as ready for reviewDecember 22, 2025 14:50
Comment on lines +67 to +84
function groupEnumsByName(enums) {
var grouped = {};
for (var i = 0; i < enums.length; i++) {
var e = enums[i];
if (!grouped[e.name]) {
grouped[e.name] = [];
}
if (grouped[e.name].indexOf(e.value) === -1) {
grouped[e.name].push(e.value);
}
}
var result = [];
for (var name in grouped) {
grouped[name].sort();
result.push({name: name, values: grouped[name]});
}
return result;
}
Copy link
Member

Choose a reason for hiding this comment

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

TIL you can embed JavaScript into a DOT 🤯

mtojek reacted with rocket emoji
@mtojekmtojek merged commit0af038b intomainDec 22, 2025
32 checks passed
@mtojekmtojek deleted the enums-1 branchDecember 22, 2025 15:19
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsDec 22, 2025
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.

Reviewers

@johnstcnjohnstcnjohnstcn approved these changes

@matifalimatifaliAwaiting requested review from matifali

Assignees

@mtojekmtojek

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

duplicated entries in API docs

3 participants

@mtojek@johnstcn

[8]ページ先頭

©2009-2025 Movatter.jp