department-of-veterans-affairs/vets-website

View on GitHub
src/applications/pre-need/config/pages/applicantDemographics.jsx

Summary

Maintainability
A
2 hrs
Test Coverage
import fullSchemaPreNeed from 'vets-json-schema/dist/40-10007-schema.json';

import { pick } from 'lodash';

import {
  applicantDemographicsDescription,
  applicantDemographicsSubHeader,
  veteranUI,
} from '../../utils/helpers';

const { veteran } = fullSchemaPreNeed.properties.application.properties;

export const uiSchema = {
  application: {
    'ui:title': applicantDemographicsSubHeader,
    'ui:description': applicantDemographicsDescription,
    veteran: veteranUI,
  },
};
export const schema = {
  type: 'object',
  properties: {
    application: {
      type: 'object',
      properties: {
        veteran: {
          type: 'object',
          required: ['gender', 'race', 'maritalStatus'],
          properties: pick(veteran.properties, [
            'gender',
            'race',
            'maritalStatus',
          ]),
        },
      },
    },
  },
};