Skip to content

Commit a6e5486

Browse files
committed
Make default types available (for testing)
1 parent 40caab4 commit a6e5486

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/services/schemaForm.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ export default function() {
7676
this.$get = function() {
7777

7878
var service = {};
79+
var typeDefault = this.defaults;
7980

8081
service.merge = function(schema, form, ignore, options, readonly, asyncTemplates) {
8182
form = form || ['*'];
@@ -84,7 +85,7 @@ export default function() {
8485
// Get readonly from root object
8586
readonly = readonly || schema.readonly || schema.readOnly;
8687

87-
const stdForm = schemaDefaults.defaultForm(schema, defaults ,ignore, options);
88+
const stdForm = schemaDefaults.defaultForm(schema, typeDefault ,ignore, options);
8889

8990
//simple case, we have a "*", just put the stdForm there
9091
var idx = form.indexOf('*');
@@ -104,7 +105,14 @@ export default function() {
104105
* Create form defaults from schema
105106
*/
106107
service.defaults = schemaDefaults.defaultForm;
108+
107109
//Utility functions
110+
/**
111+
* Form defaults for schema by type
112+
* As a form is generated from a schema these are the definitions of each json-schema type
113+
*/
114+
service.typeDefault = typeDefault;
115+
108116
/**
109117
* Traverse a schema, applying a function(schema,path) on every sub schema
110118
* i.e. every property of an object.

0 commit comments

Comments
 (0)