Documentation ¶
Overview ¶
Package jsonschema adds juju-specific metadata to jsonschema.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DependencyMap ¶
DependencyMap contains the dependencies defined within this schema. for a given dependency name, you can have either a schema or a list of property names
type Schema ¶
type Schema struct { ID string `json:"id,omitempty"` Title string `json:"title,omitempty"` Description string `json:"description,omitempty"` Default interface{} `json:"default,omitempty"` Type []Type `json:"type,omitempty"` SchemaRef string `json:"$schema,omitempty"` Definitions map[string]*Schema `json:"definitions,omitempty"` Reference string `json:"$ref,omitempty"` Format Format `json:"format,omitempty"` // NumericValidations MultipleOf *float64 `json:"multipleOf,omitempty"` Minimum *float64 `json:"minimum,omitempty"` Maximum *float64 `json:"maximum,omitempty"` ExclusiveMinimum *bool `json:"exclusiveMinimum,omitempty"` ExclusiveMaximum *bool `json:"exclusiveMaximum,omitempty"` // StringValidation MaxLength *int `json:"maxLength,omitempty"` MinLength *int `json:"minLength,omitempty"` Pattern *regexp.Regexp `json:"pattern,omitempty"` // ArrayValidations AdditionalItems *Schema `json:"additionalItems,omitempty"` Items *ItemSpec `json:"items,omitempty"` MinItems *int `json:"minItems,omitempty"` MaxItems *int `json:"maxItems,omitempty"` UniqueItems *bool `json:"uniqueItems,omitempty"` // ObjectValidations MaxProperties *int `json:"maxProperties,omitempty"` MinProperties *int `json:"minProperties,omitempty"` Required []string `json:"required,omitempty"` Dependencies DependencyMap `json:"dependencies,omitempty"` Properties map[string]*Schema `json:"properties,omitempty"` AdditionalProperties *Schema `json:"additionalProperties,omitempty"` PatternProperties map[*regexp.Regexp]*Schema `json:"patternProperties,omitempty"` Enum []interface{} `json:"enum,omitempty"` AllOf []*Schema `json:"allOf,omitempty"` AnyOf []*Schema `json:"anyOf,omitempty"` OneOf []*Schema `json:"oneOf,omitempty"` Not *Schema `json:"not,omitempty"` // Immutable specifies whether the attribute cannot // be changed once set. Immutable bool `json:"immutable,omitempty"` // Secret specifies whether the attribute should be // considered secret. Secret bool `json:"secret,omitempty"` // EnvVars holds environment variables that will be used to obtain the // default value if it isn't specified, they are checked from highest to // lowest priority. EnvVars []string `json:"env-vars,omitempty"` // Example holds an example value for the attribute // that can be used to produce a plausible-looking // entry for the attribute without necessarily using // it as a default value. // // TODO if the example holds some special values, use // it as a template to generate initial random values // (for example for admin-password) ? Example interface{} `json:"example,omitempty"` // Order is the order in which properties should be requested of the user // during an interactive session. Order []string `json:"order,omitempty"` // Singular contains the singular version of the human-friendly name of this // property. Singular string `json:"singular,omitempty"` // Plural contains the plural version of the human-friendly name of this // property. Plural string `json:"plural,omitempty"` // PromptDefault contains the default value the user can accept during // interactive add-cloud. PromptDefault interface{} `json:"prompt-default,omitempty"` // PathFor should contain the name of another property in this schema. If a // value for that property does not exist, and this property's value is set, // the value from this property is interpreted as a filepath, and the // contents of that filepath are used as the value of the given property. // This is useful for properties with large values, such as encryption keys. PathFor string `json:"path-for,omitempty"` }
Schema represents a fully defined jsonschema plus some metadata for the purposes of UX generation. See http://jsonschema.org for details.
func (*Schema) InsertDefaults ¶
InsertDefaults takes a target map and inserts any missing default values as specified in the properties map, according to JSON-Schema.
func (*Schema) MarshalJSON ¶
MarshalJSON implements the json.Marshaler.
func (*Schema) UnmarshalJSON ¶
UnmarshalJSON implements the json.Marshaler.
Click to show internal directories.
Click to hide internal directories.