Skip to content

Commit

Permalink
allow a json schema to have an add form for a property
Browse files Browse the repository at this point in the history
  • Loading branch information
jstrachan committed Apr 2, 2013
1 parent 5f91b4e commit bef41b3
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
7 changes: 7 additions & 0 deletions hawtio-web/src/main/webapp/app/forms/js/helpers.ts
Expand Up @@ -46,6 +46,13 @@ module Forms {
}
}
}
// are we a json schema properties with a link to the schema doc?
var additionalProperties = property.additionalProperties;
if (additionalProperties) {
if (additionalProperties["$ref"] === "#") {
return schema;
}
}
}
return items;
}
Expand Down
3 changes: 3 additions & 0 deletions hawtio-web/src/test/specs/SpecRunner.html
Expand Up @@ -85,6 +85,9 @@
<!-- camel model definition -->
<script type="text/javascript" src="../../main/webapp/app/camel/js/camelModel.js"></script>

<!-- json schema model -->
<script type="text/javascript" src="../../main/webapp/app/forms/js/jsonschema.js"></script>

<!-- markdown renderer -->
<script type="text/javascript" src="../../main/webapp/lib/marked.js"></script>

Expand Down
9 changes: 9 additions & 0 deletions hawtio-web/src/test/specs/spec/FormsSpec.js
Expand Up @@ -57,4 +57,13 @@ describe("Forms", function() {
expect(s2.properties.name.type).toEqual("string");
});

it("properties lookup in json schema", function() {
var propertiesSchema = Forms.findArrayItemsSchema(_jsonSchema.properties.properties, _jsonSchema);

console.log("Properties schema is " + JSON.stringify(propertiesSchema));
// we should have some properties
//expect(propertiesSchema.properties).toEqual("string");

});

});

0 comments on commit bef41b3

Please sign in to comment.