mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat: Expose the values contained in an HCL validation string to the API (#1587)
* feat: Expose the values contained in an HCL validation string to the API This allows the frontend to render inputs displaying these values! * Update codersdk/parameters.go Co-authored-by: Cian Johnston <cian@coder.com> * Call a spade a space * Fix linting errors with type conversion Co-authored-by: Cian Johnston <cian@coder.com>
This commit is contained in:
co-authored by
Cian Johnston
parent
ad9bdb7bd1
commit
38ee519f42
@@ -9,7 +9,6 @@ import (
|
||||
|
||||
"github.com/google/uuid"
|
||||
|
||||
"github.com/coder/coder/coderd/database"
|
||||
"github.com/coder/coder/coderd/parameter"
|
||||
)
|
||||
|
||||
@@ -24,9 +23,6 @@ type TemplateVersion struct {
|
||||
Readme string `json:"readme"`
|
||||
}
|
||||
|
||||
// TemplateVersionParameterSchema represents a parameter parsed from template version source.
|
||||
type TemplateVersionParameterSchema database.ParameterSchema
|
||||
|
||||
// TemplateVersionParameter represents a computed parameter value.
|
||||
type TemplateVersionParameter parameter.ComputedValue
|
||||
|
||||
@@ -58,7 +54,7 @@ func (c *Client) CancelTemplateVersion(ctx context.Context, version uuid.UUID) e
|
||||
}
|
||||
|
||||
// TemplateVersionSchema returns schemas for a template version by ID.
|
||||
func (c *Client) TemplateVersionSchema(ctx context.Context, version uuid.UUID) ([]TemplateVersionParameterSchema, error) {
|
||||
func (c *Client) TemplateVersionSchema(ctx context.Context, version uuid.UUID) ([]ParameterSchema, error) {
|
||||
res, err := c.Request(ctx, http.MethodGet, fmt.Sprintf("/api/v2/templateversions/%s/schema", version), nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -67,7 +63,7 @@ func (c *Client) TemplateVersionSchema(ctx context.Context, version uuid.UUID) (
|
||||
if res.StatusCode != http.StatusOK {
|
||||
return nil, readBodyAsError(res)
|
||||
}
|
||||
var params []TemplateVersionParameterSchema
|
||||
var params []ParameterSchema
|
||||
return params, json.NewDecoder(res.Body).Decode(¶ms)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user