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
@@ -95,11 +95,18 @@ func (api *api) templateVersionSchema(rw http.ResponseWriter, r *http.Request) {
|
||||
})
|
||||
return
|
||||
}
|
||||
if schemas == nil {
|
||||
schemas = []database.ParameterSchema{}
|
||||
apiSchemas := make([]codersdk.ParameterSchema, 0)
|
||||
for _, schema := range schemas {
|
||||
apiSchema, err := convertParameterSchema(schema)
|
||||
if err != nil {
|
||||
httpapi.Write(rw, http.StatusInternalServerError, httpapi.Response{
|
||||
Message: fmt.Sprintf("convert: %s", err),
|
||||
})
|
||||
return
|
||||
}
|
||||
apiSchemas = append(apiSchemas, apiSchema)
|
||||
}
|
||||
|
||||
httpapi.Write(rw, http.StatusOK, schemas)
|
||||
httpapi.Write(rw, http.StatusOK, apiSchemas)
|
||||
}
|
||||
|
||||
func (api *api) templateVersionParameters(rw http.ResponseWriter, r *http.Request) {
|
||||
|
||||
Reference in New Issue
Block a user