Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions codersdk/templateversions.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,14 @@ type DynamicParametersResponse struct {
// TODO: Workspace tags
}

// FriendlyDiagnostic is included to guarantee it is generated in the output
// types. This is used as the type override for `previewtypes.Diagnostic`.
type FriendlyDiagnostic = previewtypes.FriendlyDiagnostic

// NullHCLString is included to guarantee it is generated in the output
// types. This is used as the type override for `previewtypes.HCLString`.
type NullHCLString = previewtypes.NullHCLString

func (c *Client) TemplateVersionDynamicParameters(ctx context.Context, version uuid.UUID) (*wsjson.Stream[DynamicParametersResponse, DynamicParametersRequest], error) {
conn, err := c.Dial(ctx, fmt.Sprintf("/api/v2/templateversions/%s/dynamic-parameters", version), nil)
if err != nil {
Expand Down
25 changes: 19 additions & 6 deletions scripts/apitypings/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,9 @@ func main() {
// Serpent has some types referenced in the codersdk.
// We want the referenced types generated.
referencePackages := map[string]string{
"github.com/coder/preview": "",
"github.com/coder/serpent": "Serpent",
"github.com/hashicorp/hcl/v2": "Hcl",
"tailscale.com/derp": "",
"github.com/coder/preview/types": "Preview",
"github.com/coder/serpent": "Serpent",
"tailscale.com/derp": "",
// Conflicting name "DERPRegion"
"tailscale.com/tailcfg": "Tail",
"tailscale.com/net/netcheck": "Netcheck",
Expand Down Expand Up @@ -90,8 +89,22 @@ func TypeMappings(gen *guts.GoParser) error {
gen.IncludeCustomDeclaration(map[string]guts.TypeOverride{
"github.com/coder/coder/v2/codersdk.NullTime": config.OverrideNullable(config.OverrideLiteral(bindings.KeywordString)),
// opt.Bool can return 'null' if unset
"tailscale.com/types/opt.Bool": config.OverrideNullable(config.OverrideLiteral(bindings.KeywordBoolean)),
"github.com/hashicorp/hcl/v2.Expression": config.OverrideLiteral(bindings.KeywordUnknown),
"tailscale.com/types/opt.Bool": config.OverrideNullable(config.OverrideLiteral(bindings.KeywordBoolean)),
// hcl diagnostics should be cast to `preview.FriendlyDiagnostic`
"github.com/hashicorp/hcl/v2.Diagnostic": func() bindings.ExpressionType {
return bindings.Reference(bindings.Identifier{
Name: "FriendlyDiagnostic",
Package: nil,
Prefix: "",
})
},
"github.com/coder/preview/types.HCLString": func() bindings.ExpressionType {
return bindings.Reference(bindings.Identifier{
Name: "NullHCLString",
Package: nil,
Prefix: "",
})
},
})

err := gen.IncludeCustom(map[string]string{
Expand Down
110 changes: 68 additions & 42 deletions site/src/api/typesGenerated.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy