SchemaToCode
NGX-SCHEMA-TO-CODE

Copy & save employee.json in angular projects root folder. Modify it as per your requirement and generate CURD working code for the 'Employee' entity.

Use following command to generate CURD code.

ng generate ngx-schema-to-code:curd employee.json

employee.json

{
  "employee": {
    "firstName": {
      "dataType": "string",
      "inputType": "text",
      "validation": {
        "required": true,
        "minLength": 5,
        "maxLength": 30
      },
      "hint": "First Name should be at minimum 5 characters long and maximum 30."
    },
    "lastName": {
      "dataType": "string"
    },
    "emailAddress": {
      "dataType": "string",
      "inputType": "email"
    },
    "photo": {
      "dataType": "file",
      "displayName": "Passport photo",
      "inputType": "image",
      "validation": {
        "required": true
      }
    },
    "gender": {
      "dataType": "string",
      "inputType": "radio",
      "options": [
        {
          "description": "Male",
          "value": "m"
        },
        {
          "description": "Female",
          "value": "f"
        }
      ],
      "validation": {
        "required": true
      }
    },
    "dob": {
      "dataType": "string",
      "displayName": "Birth Date",
      "format": "dd/mm/yyyy",
      "inputType": "date",
      "validation": {
        "required": true
      }
    },
    "address": {
      "dataType": "group",
      "displayName": "Current Address",
      "inputType": "group",
      "properties": {
        "area": {
          "dataType": "string",
          "displayName": "Area",
          "inputType": "text",
          "validation": {
            "required": true,
            "maxLength": 50
          }
        },
        "city": {
          "dataType": "string",
          "displayName": "City",
          "inputType": "text",
          "validation": {
            "required": true
          }
        }
      }
    },
    "education": {
      "dataType": "array",
      "displayName": "Education",
      "inputType": "text",
      "validation": {
        "required": true
      }
    },
    "designation": {
      "dataType": "string",
      "validation": {
        "required": true
      }
    },
    "salary": {
      "dataType": "number",
      "displayName": "Salary",
      "inputType": "number",
      "validation": {
        "required": true,
        "min": 1000,
        "max": 75000
      },
      "step": 1000,
      "hint": "Salary should be between 1000 and 75000."
    },
    "department": {
      "dataType": "string",
      "displayName": "Department",
      "inputType": "select",
      "optionValues": [
        "Account",
        "Human Resource",
        "Sales"
      ],
      "validation": {
        "required": true
      }
    }
  }
}