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 workspace agents and builds#5538

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 20 commits intocoder:mainfrommtojek:3522-workspacebuilds-1
Jan 5, 2023

Conversation

mtojek
Copy link
Member

@mtojekmtojek commentedJan 2, 2023
edited
Loading

Related:#3522

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

Changes:

  • workspaceagents.go
  • workspacebuilds.go (also affects/workspaces)

@mtojekmtojek self-assigned thisJan 2, 2023
@mtojekmtojek mentioned this pull requestJan 2, 2023
29 tasks
@mtojekmtojek marked this pull request as ready for reviewJanuary 3, 2023 18:48
@mtojekmtojek changed the titledocs: workspace agents and buildsdocs: API workspace agents and buildsJan 4, 2023
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.

Some minor questions and suggestions but looks good in all! 👍🏻

DisconnectedAt *time.Time `json:"disconnected_at,omitempty"`
Status WorkspaceAgentStatus `json:"status"`
ID uuid.UUID `json:"id" format:"uuid"`
CreatedAt time.Time `json:"created_at" format:"date-time"`
Copy link
Member

Choose a reason for hiding this comment

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

Perhaps I've asked before, but is there a way to automatically transform these based on the Go type? It seems unfortunate we'd have to tag every new struct, and we will almost certainly miss to add the tag to fields in the future.

It'd be nice ifformat was reserved as an override sinceuuid andtime.Time are essentially never a different format (would take a custom json Marshaller at which point usingformat would be appropriate).

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

I'm afraid that we would need a fork to apply this feature, let's say,auto-format. It doesn't look like something we can truly solve just with validation.

I'm not sure why it hasn't been implemented this way. Even officialexamples suggest usingformat tags.

Copy link
Member

Choose a reason for hiding this comment

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

I can certainly understand why it's not the default (due to middlewares and handlers that can do whatever). But it'd be nice to enable such a feature.

Do you think they'd be open to it if we made a PR? Seems like many people could benefit.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

At the moment, we're using versionswaggo v1.8.6, but I can try to bump it tov1.8.9 so that we will also benefit from future PRs. AFAIR v1.8.9 added a lot of noise around all possible values oftime.Duration or strange value examples:

-    "value": 0+    "value": -9223372036854776000

Copy link
Member

Choose a reason for hiding this comment

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

Ah, ifv1.8.9 is problematic we can punt it for now unless you think there's a benefit to upgrading?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Let me prepare a draft PR and we can discuss the upgrade there.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

@@ -65,13 +65,15 @@ type WorkspaceBuild struct {
InitiatorID uuid.UUID `json:"initiator_id" format:"uuid"`
InitiatorUsername string `json:"initiator_name"`
Job ProvisionerJob `json:"job"`
Reason BuildReason `db:"reason" json:"reason"`
Reason BuildReason `db:"reason" json:"reason" enums:"initiator,autostart,autostop"`
Copy link
Member

Choose a reason for hiding this comment

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

Nice work! Once we get the docs in shape, it'd be nice to try to process the Go code to find these enums automatically.

Btw, would it be possible to move this enum description to the type? Like:

// BuildReason ...// @enum initiator,autostart,autostoptypeBuildReasonstring

Perhaps not supported by swaggo.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

There are some magic undocumented extensions likex-enum-varnames orx-enum-descriptions, but I don't think that this is what we're looking for.

Seeswaggo/swag#984

Copy link
Member

Choose a reason for hiding this comment

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

Indeed, that seems useful with enums that are number based and have string representations in (de-)serialization.

DisconnectedAt *time.Time `json:"disconnected_at,omitempty"`
Status WorkspaceAgentStatus `json:"status"`
ID uuid.UUID `json:"id" format:"uuid"`
CreatedAt time.Time `json:"created_at" format:"date-time"`
Copy link
Member

Choose a reason for hiding this comment

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

Ah, ifv1.8.9 is problematic we can punt it for now unless you think there's a benefit to upgrading?

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

@bpmctbpmctbpmct left review comments

@mafredrimafredrimafredri approved these changes

Assignees

@mtojekmtojek

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@mtojek@mafredri@bpmct

[8]ページ先頭

©2009-2025 Movatter.jp