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: API users#5620

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 42 commits intocoder:mainfrommtojek:3522-organizations-1
Jan 11, 2023
Merged

docs: API users#5620

mtojek merged 42 commits intocoder:mainfrommtojek:3522-organizations-1
Jan 11, 2023

Conversation

mtojek
Copy link
Member

@mtojekmtojek commentedJan 9, 2023
edited
Loading

Related:#3522

Blocker:#5546 (this PR is built on top of that branch)

Changes:

  • users

@mtojekmtojek self-assigned thisJan 9, 2023
@mtojekmtojek mentioned this pull requestJan 9, 2023
29 tasks
@mtojekmtojek changed the titledocs: API users, organizationsdocs: API usersJan 9, 2023
@mtojekmtojek mentioned this pull requestJan 9, 2023
@mtojekmtojek marked this pull request as ready for reviewJanuary 11, 2023 11:23
Copy link
Member

@mafredrimafredri left a comment

Choose a reason for hiding this comment

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

Super, nice job!

// @Param user path string true "User ID, name, or me"
// @Param request body codersdk.CreateTokenRequest true "Create token request"
// @Success 201 {object} codersdk.GenerateAPIKeyResponse
// @Router /users/{user}/keys/tokens [post]
Copy link
Member

Choose a reason for hiding this comment

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

I recently learned aboutswag fmt.

go run github.com/swaggo/swag/cmd/swag@latest fmt --dir ./coderd

Should we enable it for our repo? It's pretty fast.

One gotcha though: Every function needs a proper comment body or go fmt will undo some of the changes.

Example:

swag fmt:

//@SummaryGet audit logs//@IDget-audit-logs//@SecurityCoderSessionToken//@Producejson//@TagsAudit//@Paramqquerystringtrue"Search query"//@Paramafter_idquerystringfalse"After ID"format(uuid)//@Paramlimitqueryintfalse"Page limit"//@Paramoffsetqueryintfalse"Page offset"//@Success200{object}codersdk.AuditLogResponse//@Router/audit [get]

go fmt:

// @SummaryGet audit logs// @IDget-audit-logs// @SecurityCoderSessionToken// @Producejson// @TagsAudit// @Paramqquerystringtrue"Search query"// @Paramafter_idquerystringfalse"After ID"format(uuid)// @Paramlimitqueryintfalse"Page limit"// @Paramoffsetqueryintfalse"Page offset"// @Success200{object}codersdk.AuditLogResponse// @Router/audit [get]

(Notice tab prefix -> space.)

However, with a comment it's fine.

// Get audit logs.////@SummaryGet audit logs//@IDget-audit-logs//@SecurityCoderSessionToken//@Producejson//@TagsAudit//@Paramqquerystringtrue"Search query"//@Paramafter_idquerystringfalse"After ID"format(uuid)//@Paramlimitqueryintfalse"Page limit"//@Paramoffsetqueryintfalse"Page offset"//@Success200{object}codersdk.AuditLogResponse//@Router/audit [get]

I dislike the full-on tab indentation though (will be messy for different settings of editor indentation display). We could submit a PR toswaggo/swag to use space indentation for everythingexcept the prefix. Related PR that changed the behavior:swaggo/swag#1386 from all space to all tab (vs just fixing the prefix).

Copy link
MemberAuthor

@mtojekmtojekJan 11, 2023
edited
Loading

Choose a reason for hiding this comment

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

I can enable it in a separate PR to cover all changes, but I'm concerned if it doesn't conflict with the project formatter.

@mtojekmtojek merged commit8e9cbdd intocoder:mainJan 11, 2023
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsJan 11, 2023
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers

@mafredrimafredrimafredri approved these changes

@bpmctbpmctAwaiting requested review from bpmct

Assignees

@mtojekmtojek

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@mtojek@mafredri

[8]ページ先頭

©2009-2025 Movatter.jp