Skip to content

Commit

Permalink
feat(SchemaUtil): parse a partial definition
Browse files Browse the repository at this point in the history
  • Loading branch information
nLight committed Sep 11, 2017
1 parent d3e0f08 commit 552770a
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/js/utils/SchemaUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ const SchemaUtil = {

Object.keys(schemaProperties).forEach(function(topLevelProp) {
const topLevelPropertyObject = schemaProperties[topLevelProp];
const secondLevelProperties = topLevelPropertyObject.properties;
const secondLevelProperties = topLevelPropertyObject.properties || {};
const requiredProps = topLevelPropertyObject.required;
const definitionForm = (multipleDefinition[topLevelProp] = {});

Expand Down
23 changes: 23 additions & 0 deletions src/js/utils/__tests__/SchemaUtil-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,29 @@ describe("SchemaUtil", function() {
});
});

describe("schema with no second level properties", function() {
const $scope = {};
beforeEach(function() {
var schema = {
properties: {
application: {
description: "This is a description"
}
}
};

$scope.subheaderRender = jasmine.createSpy();
$scope.result = SchemaUtil.schemaToMultipleDefinition({
schema,
renderSubheader: $scope.subheaderRender
});
});

it("creates the definition", function() {
expect($scope.result.application.definition).toEqual([]);
});
});

describe("nested schema", function() {
beforeEach(function() {
var schema = {
Expand Down

0 comments on commit 552770a

Please sign in to comment.