Skip to content

fix: adjust ParameterSchema type for workspace creation #2384

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jun 15, 2022
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
2 changes: 1 addition & 1 deletion codersdk/parameters.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ type ParameterSchema struct {

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

// CreateParameterRequest is used to create a new parameter value for a scope.
Expand Down
2 changes: 1 addition & 1 deletion site/src/api/typesGenerated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ export interface ParameterSchema {
readonly validation_condition: string
readonly validation_type_system: string
readonly validation_value_type: string
readonly validation_contains: string[]
readonly validation_contains?: string[]
}

// From codersdk/provisionerdaemons.go:33:6
Expand Down
2 changes: 1 addition & 1 deletion site/src/components/ParameterInput/ParameterInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const ParameterInput: FC<ParameterInputProps> = ({ disabled, onChange, sc
}

const ParameterField: React.FC<ParameterInputProps> = ({ disabled, onChange, schema }) => {
if (schema.validation_contains.length > 0) {
if (schema.validation_contains && schema.validation_contains.length > 0) {
return (
<RadioGroup
defaultValue={schema.default_source_value}
Expand Down