Skip to content

Commit 0f44048

Browse files
authored
fix: adjust ParameterSchema type for workspace creation (#2384)
* add ability to activate users resolves #2254 * added test * PR feedback * guarding against null validation_contains field * fixing type for ParameterSchema resolves #2161
1 parent 2e625c1 commit 0f44048

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

codersdk/parameters.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ type ParameterSchema struct {
7272

7373
// This is a special array of items provided if the validation condition
7474
// explicitly states the value must be one of a set.
75-
ValidationContains []string `json:"validation_contains"`
75+
ValidationContains []string `json:"validation_contains,omitempty"`
7676
}
7777

7878
// CreateParameterRequest is used to create a new parameter value for a scope.

site/src/api/typesGenerated.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ export interface ParameterSchema {
190190
readonly validation_condition: string
191191
readonly validation_type_system: string
192192
readonly validation_value_type: string
193-
readonly validation_contains: string[]
193+
readonly validation_contains?: string[]
194194
}
195195

196196
// From codersdk/provisionerdaemons.go:33:6

site/src/components/ParameterInput/ParameterInput.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export const ParameterInput: FC<ParameterInputProps> = ({ disabled, onChange, sc
2929
}
3030

3131
const ParameterField: React.FC<ParameterInputProps> = ({ disabled, onChange, schema }) => {
32-
if (schema.validation_contains.length > 0) {
32+
if (schema.validation_contains && schema.validation_contains.length > 0) {
3333
return (
3434
<RadioGroup
3535
defaultValue={schema.default_source_value}

0 commit comments

Comments
 (0)
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