Language.ts 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /** This file is generated based on JSON schema. Do not modify. */
  2. import * as Yup from 'yup';
  3. import { EntityCodec } from '@joystream/types/versioned-store/EntityCodec';
  4. export const LanguageValidationSchema = Yup.object().shape({
  5. value: Yup.string()
  6. .required('This field is required')
  7. .max(2, 'Text is too long. Maximum length is 2 chars.')
  8. });
  9. export type LanguageFormValues = {
  10. value: string
  11. };
  12. export type LanguageType = {
  13. classId: number
  14. inClassSchemaIndexes: number[]
  15. id: number
  16. value: string
  17. };
  18. export class LanguageCodec extends EntityCodec<LanguageType> { }
  19. export function LanguageToFormValues(entity?: LanguageType): LanguageFormValues {
  20. return {
  21. value: entity && entity.value || ''
  22. }
  23. }
  24. export type LanguagePropId =
  25. 'value'
  26. ;
  27. export type LanguageGenericProp = {
  28. id: LanguagePropId,
  29. type: string,
  30. name: string,
  31. description?: string,
  32. required?: boolean,
  33. maxItems?: number,
  34. maxTextLength?: number,
  35. classId?: any
  36. };
  37. type LanguageClassType = {
  38. [id in LanguagePropId]: LanguageGenericProp
  39. };
  40. export const LanguageClass: LanguageClassType = {
  41. value: {
  42. "id": "value",
  43. "name": "Value",
  44. "description": "Language code following the ISO 639-1 two letter standard.",
  45. "type": "Text",
  46. "required": true,
  47. "maxTextLength": 2
  48. }
  49. };