chore: fixup typegen for preview types (#17339)

Preview types override the json marshal behavior.
This commit is contained in:
Steven Masley
2025-04-11 13:21:46 -05:00
committed by GitHub
parent 7b0422b49b
commit 15584e69ef
3 changed files with 95 additions and 48 deletions
+68 -42
View File
@@ -715,10 +715,8 @@ export interface DynamicParametersRequest {
// From codersdk/templateversions.go
export interface DynamicParametersResponse {
readonly id: number;
// this is likely an enum in an external package "github.com/coder/preview/types.Diagnostics"
readonly diagnostics: readonly (HclDiagnostic | null)[];
// external type "github.com/coder/preview/types.Parameter", to include this type the package must be explicitly included in the parsing
readonly parameters: readonly unknown[];
readonly diagnostics: PreviewDiagnostics;
readonly parameters: readonly PreviewParameter[];
}
// From codersdk/externalauth.go
@@ -914,6 +912,13 @@ export const FeatureSets: FeatureSet[] = ["enterprise", "", "premium"];
// From codersdk/files.go
export const FormatZip = "zip";
// From codersdk/templateversions.go
export interface FriendlyDiagnostic {
readonly severity: PreviewDiagnosticSeverityString;
readonly summary: string;
readonly detail: string;
}
// From codersdk/apikey.go
export interface GenerateAPIKeyResponse {
readonly key: string;
@@ -997,44 +1002,6 @@ export interface HTTPCookieConfig {
readonly same_site?: string;
}
// From hcl/diagnostic.go
export interface HclDiagnostic {
readonly Severity: HclDiagnosticSeverity;
readonly Summary: string;
readonly Detail: string;
readonly Subject: HclRange | null;
readonly Context: HclRange | null;
readonly Expression: unknown;
readonly EvalContext: HclEvalContext | null;
// empty interface{} type, falling back to unknown
readonly Extra: unknown;
}
// From hcl/diagnostic.go
export type HclDiagnosticSeverity = number;
// From hcl/eval_context.go
export interface HclEvalContext {
// external type "github.com/zclconf/go-cty/cty.Value", to include this type the package must be explicitly included in the parsing
readonly Variables: Record<string, unknown>;
// external type "github.com/zclconf/go-cty/cty/function.Function", to include this type the package must be explicitly included in the parsing
readonly Functions: Record<string, unknown>;
}
// From hcl/pos.go
export interface HclPos {
readonly Line: number;
readonly Column: number;
readonly Byte: number;
}
// From hcl/pos.go
export interface HclRange {
readonly Filename: string;
readonly Start: HclPos;
readonly End: HclPos;
}
// From health/model.go
export type HealthCode =
| "EACS03"
@@ -1439,6 +1406,12 @@ export interface NotificationsWebhookConfig {
readonly endpoint: string;
}
// From codersdk/templateversions.go
export interface NullHCLString {
readonly value: string;
readonly valid: boolean;
}
// From codersdk/oauth2.go
export interface OAuth2AppEndpoints {
readonly authorization: string;
@@ -1740,6 +1713,59 @@ export interface PresetParameter {
readonly Value: string;
}
// From types/diagnostics.go
export type PreviewDiagnosticSeverityString = string;
// From types/diagnostics.go
export type PreviewDiagnostics = readonly (FriendlyDiagnostic | null)[];
// From types/parameter.go
export interface PreviewParameter extends PreviewParameterData {
readonly value: NullHCLString;
readonly diagnostics: PreviewDiagnostics;
}
// From types/parameter.go
export interface PreviewParameterData {
readonly name: string;
readonly display_name: string;
readonly description: string;
readonly type: PreviewParameterType;
// this is likely an enum in an external package "github.com/coder/terraform-provider-coder/v2/provider.ParameterFormType"
readonly form_type: string;
// empty interface{} type, falling back to unknown
readonly styling: unknown;
readonly mutable: boolean;
readonly default_value: NullHCLString;
readonly icon: string;
readonly options: readonly (PreviewParameterOption | null)[];
readonly validations: readonly (PreviewParameterValidation | null)[];
readonly required: boolean;
readonly order: number;
readonly ephemeral: boolean;
}
// From types/parameter.go
export interface PreviewParameterOption {
readonly name: string;
readonly description: string;
readonly value: NullHCLString;
readonly icon: string;
}
// From types/enum.go
export type PreviewParameterType = string;
// From types/parameter.go
export interface PreviewParameterValidation {
readonly validation_error: string;
readonly validation_regex: string | null;
readonly validation_min: number | null;
readonly validation_max: number | null;
readonly validation_monotonic: string | null;
readonly validation_invalid: boolean | null;
}
// From codersdk/deployment.go
export interface PrometheusConfig {
readonly enable: boolean;