diff --git a/js/formDataToJson.js b/js/formDataToJson.js index d7cd59f..d657683 100644 --- a/js/formDataToJson.js +++ b/js/formDataToJson.js @@ -57,7 +57,7 @@ function populateObject(data, schema) { } async function populateCodeJson(data) { - const filePath = "schemas/schema-0.0.0.json"; + const filePath = "schemas/schema.json"; // Retrieves schema with fields in correct order const schema = await retrieveFile(filePath); diff --git a/js/generateFormComponents.js b/js/generateFormComponents.js index b82bea0..d9e3086 100644 --- a/js/generateFormComponents.js +++ b/js/generateFormComponents.js @@ -49,6 +49,9 @@ function determineType(field) { return "radio"; } else if (field.type === "number") { return "number"; + } + else if (field.type === "integer") { + return "integer"; } else if (field.type === "boolean") { return "select-boolean"; } else if (field.type === "string" || field.type.includes("string")) { @@ -102,6 +105,24 @@ function createComponent(fieldName, fieldObject, requiredArray) { description: fieldObject["description"], validate }; + case "integer": + return { + label: fieldName, + applyMaskOn: "change", + mask: false, + tableView: false, + delimiter: false, + requireDecimal: false, + decimalLimit: 0, + inputFormat: "plain", + truncateMultipleSpaces: false, + validateWhenHidden: false, + key: fieldName, + type: "number", + input: true, + description: fieldObject["description"], + validate + }; case "radio": var options = transformArrayToOptions(fieldObject.enum); console.log("checking options here:", options); @@ -142,8 +163,7 @@ function createComponent(fieldName, fieldObject, requiredArray) { disableWeekends: false, disableWeekdays: false }, - enableMinDateInput: false, - enableMaxDateInput: false, + enableTime: false, validateWhenHidden: false, key: fieldName, type: "datetime", @@ -155,16 +175,10 @@ function createComponent(fieldName, fieldObject, requiredArray) { useLocaleSettings: false, allowInput: true, mode: "single", - enableTime: true, noCalendar: false, - format: "yyyy-MM-dd hh:mm a", - hourIncrement: 1, - minuteIncrement: 1, - time_24hr: false, - minDate: null, + format: "yyyy-MM-dd", disableWeekends: false, disableWeekdays: false, - maxDate: null }, description: fieldObject["description"], validate @@ -196,12 +210,14 @@ function createComponent(fieldName, fieldObject, requiredArray) { case "container": return { label: fieldName, + hideLabel: false, tableView: false, validateWhenHidden: false, key: fieldName, type: "container", input: true, components: [], + description: fieldObject["description"], validate }; case "datagrid": @@ -272,7 +288,7 @@ function createAllComponents(schema, prefix = ""){ async function createFormComponents() { let components = []; - const filePath = "schemas/schema-0.0.0.json"; + const filePath = "schemas/schema.json"; const jsonData = await retrieveFile(filePath); console.log("JSON Data:", jsonData); @@ -285,7 +301,7 @@ async function createFormComponents() { type: "button", label: "Submit", key: "submit", - disableOnInvalid: true, + disableOnInvalid: false, input: true, tableView: false, }); diff --git a/schemas/schema-0.0.0.json b/schemas/schema.json similarity index 83% rename from schemas/schema-0.0.0.json rename to schemas/schema.json index 050009a..8bca3eb 100644 --- a/schemas/schema-0.0.0.json +++ b/schemas/schema.json @@ -39,6 +39,7 @@ "properties": { "licenses": { "type": "array", + "description": "License(s) for the release", "items": { "type": "object", "properties": { @@ -65,7 +66,7 @@ "URL": { "type": "string", "format": "uri", - "description": "The URL of the release license" + "description": "The URL of the release license in the repository" } }, "required": [ @@ -115,6 +116,22 @@ "format": "uri", "description": "The URL of the public release repository for open source repositories. This field is not required for repositories that are only available as government-wide reuse or are closed (pursuant to one of the exemptions)." }, + "repositoryHost": { + "type": "string", + "description": "Location where source code is hosted", + "enum": [ + "github.com/CMSgov", + "github.com/CMS-Enterprise", + "github.com/DSACMS", + "github.cms.gov", + "CCSQ GitHub" + ] + }, + "repositoryVisibility": { + "type": "string", + "enum": ["public", "private"], + "description": "Visibility of repository" + }, "vcs": { "type": "string", "description": "Version control system used", @@ -128,7 +145,17 @@ }, "laborHours": { "type": "number", - "description": "Labor hours invested in the project" + "description": "Labor hours invested in the project. Calculated using COCOMO measured by the SCC tool: https://github.com/boyter/scc?tab=readme-ov-file#cocomo" + }, + "reuseFrequency": { + "type": "object", + "description": "Measures frequency of code reuse in various forms. (e.g. forks, downloads, clones)", + "properties": { + "forks": { + "type": "integer" + } + }, + "additionalProperties": true }, "platforms": { "type": "array", @@ -185,6 +212,10 @@ "none" ] }, + "contractNumber": { + "type": "integer", + "description": "Contract number" + }, "date": { "type": "object", "description": "A date object describing the release", @@ -192,7 +223,7 @@ "created": { "type": "string", "format": "date-time", - "description": "Creation date of the project" + "description": "Creation date of project." }, "lastModified": { "type": "string", @@ -228,6 +259,13 @@ } } }, + "feedbackMechanisms": { + "type": "array", + "description": "Methods a repository receives feedback from the community. Default value is the URL to GitHub repository issues page.", + "items": { + "type": "string" + } + }, "localisation": { "type": "boolean", "description": "Indicates if the project supports multiple languages" @@ -252,7 +290,7 @@ }, "fismaLevel": { "type": "string", - "description": "FISMA security level", + "description": "Level of security categorization assigned to an information system under the Federal Information Security Modernization Act (FISMA): https://security.cms.gov/learn/federal-information-security-modernization-act-fisma", "enum": [ "Low", "Moderate", @@ -263,6 +301,27 @@ "type": "string", "description": "Home Department / Org / Group associated with the project" }, + "projects": { + "type": "array", + "description": "Maps the repository to associated projects", + "items": { + "type": "string" + } + }, + "systems": { + "type": "array", + "description": "Maps the repository to CMS systems used", + "items": { + "type": "string" + } + }, + "upstream": { + "type": "array", + "description": "List of upstream repositories and dependencies used", + "items": { + "type": "string" + } + }, "subsetInHealthcare": { "type": "array", "items": { @@ -288,16 +347,6 @@ }, "description": "Types of users who interact with the software" }, - "repositoryHost": { - "type": "string", - "description": "Location where source code is hosted", - "enum": [ - "github.com/CMSgov", - "github.com/CMS-Enterprise", - "github.cms.gov", - "CCSQ GitHub" - ] - }, "maturityModelTier": { "type": "integer", "enum": [ @@ -306,7 +355,7 @@ 3, 4 ], - "description": "Maturity model tier" + "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" } } }, @@ -318,24 +367,29 @@ "permissions", "organization", "repositoryURL", + "repositoryHost", + "repositoryVisibility", "vcs", "laborHours", + "reuseFrequency", "platforms", "categories", "softwareType", "languages", "maintenance", + "contractNumber", "date", "tags", "contact", + "feedbackMechanisms", "localisation", "repositoryType", "userInput", "fismaLevel", "group", + "projects", "subsetInHealthcare", "userType", - "repositoryHost", "maturityModelTier" ], "additionalProperties": false