Skip to content

Commit

Permalink
Add immutable flag to parameters. (#212)
Browse files Browse the repository at this point in the history
Closes #181
  • Loading branch information
jeremyrickard authored Jul 10, 2019
1 parent abd5a93 commit 82bfdf3
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
7 changes: 5 additions & 2 deletions 101-bundle-json.md
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,8 @@ And here is how a "thick" bundle looks. Notice how the `invocationImage` and `im
"description": "The port that the backend will listen on",
"destination": {
"path": "/path/to/backend_port"
}
},
"immutable" : true
}
}
},
Expand Down Expand Up @@ -480,6 +481,7 @@ Parameter specifications consist of name/value pairs. The name is fixed, but the
- `destination`: Indicates where (in the invocation image) the parameter is to be written (REQUIRED)
- `env`: The name of an environment variable
- `path`: The fully qualified path to a file that will be created. Specified path MUST NOT be a subpath of `/cnab/app/outputs`.
- `immutable`: an immutable parameter may only be set at installation. The value of the parameter cannot be changed. MUST be a boolean. Default value is false. (OPTIONAL).
- `required`: A list of required parameters. MUST be an array of strings.(OPTIONAL)

Parameter names (the keys in `fields`) ought to conform to the [Open Group Base Specification Issue 6, Section 8.1, paragraph 4](http://pubs.opengroup.org/onlinepubs/000095399/basedefs/xbd_chap08.html) definition of environment variable names with one exception: parameter names MAY begin with a digit (approximately `[A-Z0-9_]+`).
Expand Down Expand Up @@ -559,7 +561,8 @@ The structure of a `parameters` and `definitions` section looks like the section
"destination": {
"env": <string>,
"path": <string>
}
},
"immutable" : <boolean>
}
},
"required": [ <string> ]
Expand Down
1 change: 1 addition & 0 deletions 103-bundle-runtime.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ The parameter value is evaluated thus:
- If the parameter is marked `required` and a value is not supplied, the CNAB Runtime MUST produce an error and discontinue action.
- If the CNAB runtime does not provide a value, but `default` is set, then the default value MUST be used.
- If no value is provided and `default` is unset, the runtime MUST set the value to an empty string (""), regardless of type.
- If an immutable parameter value is specified at any time after _install_, the CNAB Runtime MUST produce an error and discontinue action.

> Setting the value of other types to a default value based on type, e.g. Boolean to `false` or integer to `0`, is considered _incorrect behavior_. Setting the value to `null`, `nil`, or a related character string is also considered incorrect.
Expand Down
3 changes: 2 additions & 1 deletion examples/101.02-bundle.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@
"description": "The port that the backend will listen on",
"destination": {
"path": "/path/to/backend_port"
}
},
"immutable" : true
}
}
},
Expand Down
5 changes: 5 additions & 0 deletions schema/bundle.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,11 @@
}
},
"type": "object"
},
"immutable": {
"description": "A flag indicating if the parameter value can be changed once it is set",
"type" : "boolean",
"default": false
}
},
"required": [
Expand Down

0 comments on commit 82bfdf3

Please sign in to comment.