chore: switch to guts for typescript types generation (#15801)

switch to guts for typescript type generation
omitempty vs null must now be explicit
This commit is contained in:
Steven Masley
2024-12-11 14:39:21 -06:00
committed by GitHub
parent 2ec2e8ae6d
commit 077e594856
36 changed files with 2125 additions and 1684 deletions
+5 -5
View File
@@ -131,7 +131,7 @@ func (r *HealthcheckReport) Summarize(docsURL string) []string {
// BaseReport holds fields common to various health reports.
type BaseReport struct {
Error *string `json:"error"`
Error *string `json:"error,omitempty"`
Severity health.Severity `json:"severity" enums:"ok,warning,error"`
Warnings []health.Message `json:"warnings"`
Dismissed bool `json:"dismissed"`
@@ -185,8 +185,8 @@ type DERPHealthReport struct {
// Healthy is deprecated and left for backward compatibility purposes, use `Severity` instead.
Healthy bool `json:"healthy"`
Regions map[int]*DERPRegionReport `json:"regions"`
Netcheck *netcheck.Report `json:"netcheck"`
NetcheckErr *string `json:"netcheck_err"`
Netcheck *netcheck.Report `json:"netcheck,omitempty"`
NetcheckErr *string `json:"netcheck_err,omitempty"`
NetcheckLogs []string `json:"netcheck_logs"`
}
@@ -196,7 +196,7 @@ type DERPRegionReport struct {
Healthy bool `json:"healthy"`
Severity health.Severity `json:"severity" enums:"ok,warning,error"`
Warnings []health.Message `json:"warnings"`
Error *string `json:"error"`
Error *string `json:"error,omitempty"`
Region *tailcfg.DERPRegion `json:"region"`
NodeReports []*DERPNodeReport `json:"node_reports"`
}
@@ -207,7 +207,7 @@ type DERPNodeReport struct {
Healthy bool `json:"healthy"`
Severity health.Severity `json:"severity" enums:"ok,warning,error"`
Warnings []health.Message `json:"warnings"`
Error *string `json:"error"`
Error *string `json:"error,omitempty"`
Node *tailcfg.DERPNode `json:"node"`
+3 -3
View File
@@ -157,13 +157,13 @@ type CreateTemplateRequest struct {
// AllowUserAutostart allows users to set a schedule for autostarting their
// workspace. By default this is true. This can only be disabled when using
// an enterprise license.
AllowUserAutostart *bool `json:"allow_user_autostart"`
AllowUserAutostart *bool `json:"allow_user_autostart,omitempty"`
// AllowUserAutostop allows users to set a custom workspace TTL to use in
// place of the template's DefaultTTL field. By default this is true. If
// false, the DefaultTTL will always be used. This can only be disabled when
// using an enterprise license.
AllowUserAutostop *bool `json:"allow_user_autostop"`
AllowUserAutostop *bool `json:"allow_user_autostop,omitempty"`
// FailureTTLMillis allows optionally specifying the max lifetime before Coder
// stops all resources for failed workspaces created from this template.
@@ -202,7 +202,7 @@ type CreateWorkspaceRequest struct {
// TemplateVersionID can be used to specify a specific version of a template for creating the workspace.
TemplateVersionID uuid.UUID `json:"template_version_id,omitempty" validate:"required_without=TemplateID,excluded_with=TemplateID" format:"uuid"`
Name string `json:"name" validate:"workspace_name,required"`
AutostartSchedule *string `json:"autostart_schedule"`
AutostartSchedule *string `json:"autostart_schedule,omitempty"`
TTLMillis *int64 `json:"ttl_ms,omitempty"`
// RichParameterValues allows for additional parameters to be provided
// during the initial provision.
+2 -2
View File
@@ -242,14 +242,14 @@ type UpdateTemplateMeta struct {
// any new workspaces from using this template.
// If passed an empty string, will remove the deprecated message, making
// the template usable for new workspaces again.
DeprecationMessage *string `json:"deprecation_message"`
DeprecationMessage *string `json:"deprecation_message,omitempty"`
// DisableEveryoneGroupAccess allows optionally disabling the default
// behavior of granting the 'everyone' group access to use the template.
// If this is set to true, the template will not be available to all users,
// and must be explicitly granted to users or groups in the permissions settings
// of the template.
DisableEveryoneGroupAccess bool `json:"disable_everyone_group_access"`
MaxPortShareLevel *WorkspaceAgentPortShareLevel `json:"max_port_share_level"`
MaxPortShareLevel *WorkspaceAgentPortShareLevel `json:"max_port_share_level,omitempty"`
}
type TemplateExample struct {
+1 -1
View File
@@ -260,7 +260,7 @@ type UpdateWorkspaceAutostartRequest struct {
// Schedule is expected to be of the form `CRON_TZ=<IANA Timezone> <min> <hour> * * <dow>`
// Example: `CRON_TZ=US/Central 30 9 * * 1-5` represents 0930 in the timezone US/Central
// on weekdays (Mon-Fri). `CRON_TZ` defaults to UTC if not present.
Schedule *string `json:"schedule"`
Schedule *string `json:"schedule,omitempty"`
}
// UpdateWorkspaceAutostart sets the autostart schedule for workspace by id.