Skip to content

Commit

Permalink
fix(config): relax constraints on variable and output names
Browse files Browse the repository at this point in the history
  • Loading branch information
edvald committed Aug 29, 2019
1 parent 32651d8 commit 442f8f8
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion garden-service/src/config/common.ts
Expand Up @@ -200,7 +200,7 @@ export const joiIdentifierMap = (valueSchema: JoiObject) => joi
.description("Key/value map. Keys must be valid identifiers.")

export const joiVariables = () => joi
.object().pattern(/[\w\d]+/i, joiPrimitive())
.object().pattern(/[a-zA-Z][a-zA-Z0-9_\-]+/i, joiPrimitive())
.default(() => ({}), "{}")
.unknown(false)
.description("Key/value map. Keys may contain letters and numbers, and values must be primitives.")
Expand Down
3 changes: 2 additions & 1 deletion garden-service/src/config/module.ts
Expand Up @@ -23,6 +23,7 @@ import {
import { TestConfig, TestSpec, testConfigSchema } from "./test"
import { TaskConfig, TaskSpec, taskConfigSchema } from "./task"
import { DEFAULT_API_VERSION } from "../constants"
import { joiVariables } from "./common"

export interface BuildCopySpec {
source: string
Expand Down Expand Up @@ -173,7 +174,7 @@ export interface ModuleConfig

export const moduleConfigSchema = baseModuleSpecSchema
.keys({
outputs: joiIdentifierMap(joiPrimitive())
outputs: joiVariables()
.description("The outputs defined by the module (referenceable in other module configs)."),
path: joi.string()
.description("The filesystem path of the module."),
Expand Down
4 changes: 2 additions & 2 deletions garden-service/src/config/service.ts
Expand Up @@ -7,7 +7,7 @@
*/

import deline = require("deline")
import { joiIdentifier, joiIdentifierMap, joiPrimitive, joiArray, joiUserIdentifier, joi } from "./common"
import { joiIdentifier, joiArray, joiUserIdentifier, joi, joiVariables } from "./common"

export interface ServiceSpec { }

Expand All @@ -20,7 +20,7 @@ export interface CommonServiceSpec extends ServiceSpec {
dependencies: string[]
}

export const serviceOutputsSchema = joiIdentifierMap(joiPrimitive())
export const serviceOutputsSchema = joiVariables()

export const dependenciesSchema = joiArray(joiIdentifier())
.description(deline`
Expand Down

0 comments on commit 442f8f8

Please sign in to comment.