Skip to content

Commit 781dfa6

Browse files
Merge pull request #92 from DSACMS/DSACMS/nat/bug-fixes
Form Bug Fixes
2 parents 362c773 + 2a34a4d commit 781dfa6

File tree

4 files changed

+45
-31
lines changed

4 files changed

+45
-31
lines changed

js/autoGenerateFields.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ async function preFillFields(repoData, languages) {
273273

274274
// Update feedback mechanisms
275275
if (repoData.html_url) {
276-
const feedbackComp = form.getComponent('feedbackMechanisms')
276+
const feedbackComp = form.getComponent('feedbackMechanism')
277277

278278
const issuesUrl = repoData.html_url + "/issues"
279279

js/formDataToJson.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ async function retrieveFile(filePath) {
1616

1717
function isMultiSelect(obj) {
1818
if (typeof obj !== 'object' || obj === null || Array.isArray(obj)) return false;
19-
2019
for (const key in obj) {
2120
if (typeof obj[key] !== 'boolean') {
2221
return false;
@@ -45,12 +44,17 @@ function populateObject(data, fields) {
4544
for (const field of fields) {
4645
let value = data[field];
4746

47+
// Does not assign optional properties with blank values
48+
if (value == null || value === "") {
49+
continue;
50+
}
51+
4852
// Adjusts value accordingly if multi-select field
4953
if ((typeof value === "object" && isMultiSelect(value))) {
5054
value = getSelectedOptions(value);
5155
}
5256
// Recurses if multi-field object
53-
else if (typeof value === 'object' && value !== null && Object.keys(value).length > 1) {
57+
else if (typeof value === 'object' && !Array.isArray(value) && value !== null && Object.keys(value).length > 1) {
5458
value = populateObject(value, Object.keys(value));
5559
}
5660

schemas/cms/schema.json

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@
1010
},
1111
"description": {
1212
"type": "string",
13-
"description": "A short description of the project. It should be a single line containing a single sentence. Maximum 150 characters are allowed.",
14-
"maxLength": 150
13+
"description": "A one or two sentence description of the software."
1514
},
1615
"longDescription": {
1716
"type": "string",
@@ -82,7 +81,7 @@
8281
"openSource",
8382
"governmentWideReuse",
8483
"exemptByNationalSecurity",
85-
"exemptByIntelligence",
84+
"exemptByNationalIntelligence",
8685
"exemptByFOIA",
8786
"exemptByEAR",
8887
"exemptByITAR",
@@ -115,7 +114,10 @@
115114
},
116115
"organization": {
117116
"type": "string",
118-
"description": "The organization or component within the agency to which the releases listed belong. For example, '18F' or 'Navy'."
117+
"description": "The organization or component within the agency to which the releases listed belong.",
118+
"enum": [
119+
"Centers for Medicare & Medicaid Services"
120+
]
119121
},
120122
"repositoryURL": {
121123
"type": "string",
@@ -231,8 +233,11 @@
231233
]
232234
},
233235
"contractNumber": {
234-
"type": "string",
235-
"description": "Contract number"
236+
"type": "array",
237+
"description": "Contract number(s) under which the project was developed",
238+
"items": {
239+
"type": "string"
240+
}
236241
},
237242
"date": {
238243
"type": "object",
@@ -277,12 +282,14 @@
277282
}
278283
}
279284
},
280-
"feedbackMechanisms": {
281-
"type": "array",
282-
"description": "Methods a repository receives feedback from the community. Default value is the URL to GitHub repository issues page.",
283-
"items": {
284-
"type": "string"
285-
}
285+
"feedbackMechanism": {
286+
"type": "string",
287+
"format": "uri",
288+
"description": "Method a repository receives feedback from the community (i.e. URL to GitHub repository issues page)"
289+
},
290+
"AIUseCaseID": {
291+
"type": "string",
292+
"description": "The software's ID in the AI Use Case Inventory. If the software is not currently listed in the inventory, enter '0'."
286293
},
287294
"localisation": {
288295
"type": "boolean",
@@ -372,10 +379,6 @@
372379
4
373380
],
374381
"description": "Maturity model tier according to the CMS Open Source Repository Maturity Model Framework: https://github.com/DSACMS/repo-scaffolder/blob/main/maturity-model-tiers.md"
375-
},
376-
"AIUseCaseInventory": {
377-
"type": "boolean",
378-
"description": "Is the software included in the agency's AI use case inventory?"
379382
}
380383
},
381384
"required": [
@@ -400,7 +403,8 @@
400403
"date",
401404
"tags",
402405
"contact",
403-
"feedbackMechanisms",
406+
"feedbackMechanism",
407+
"AIUseCaseID",
404408
"localisation",
405409
"repositoryType",
406410
"userInput",
@@ -409,8 +413,7 @@
409413
"projects",
410414
"subsetInHealthcare",
411415
"userType",
412-
"maturityModelTier",
413-
"AIUseCaseInventory"
416+
"maturityModelTier"
414417
],
415418
"additionalProperties": false
416-
}
419+
}

schemas/gov/schema.json

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
"openSource",
7676
"governmentWideReuse",
7777
"exemptByNationalSecurity",
78-
"exemptByIntelligence",
78+
"exemptByNationalIntelligence",
7979
"exemptByFOIA",
8080
"exemptByEAR",
8181
"exemptByITAR",
@@ -151,6 +151,13 @@
151151
},
152152
"additionalProperties": true
153153
},
154+
"languages": {
155+
"type": "array",
156+
"description": "Programming languages that make up the codebase",
157+
"items": {
158+
"type": "string"
159+
}
160+
},
154161
"maintenance": {
155162
"type": "string",
156163
"description": "The dedicated staff that keeps the software up-to-date, if any",
@@ -211,14 +218,14 @@
211218
}
212219
}
213220
},
214-
"feedbackMechanisms": {
221+
"feedbackMechanism": {
215222
"type": "string",
216223
"format": "uri",
217224
"description": "Method a repository receives feedback from the community (i.e. URL to GitHub repository issues page)"
218225
},
219-
"AIUseCaseInventory": {
220-
"type": "boolean",
221-
"description": "Is the software included in the agency's AI use case inventory?"
226+
"AIUseCaseID": {
227+
"type": "string",
228+
"description": "The software's ID in the AI Use Case Inventory. If the software is not currently listed in the inventory, enter '0'."
222229
}
223230
},
224231
"required": [
@@ -238,8 +245,8 @@
238245
"date",
239246
"tags",
240247
"contact",
241-
"feedbackMechanisms",
242-
"AIUseCaseInventory"
248+
"feedbackMechanism",
249+
"AIUseCaseID"
243250
],
244-
"additionalProperties": false
251+
"additionalProperties": true
245252
}

0 commit comments

Comments
 (0)