/examples/schemes/v_S_01_00_00/s2300_JsonSchemaEvtTSVInicio.php

https://github.com/nfephp-org/sped-esocial · PHP · 1103 lines · 1052 code · 35 blank · 16 comment · 3 complexity · 801031ea89b953af6be72eb5b9491132 MD5 · raw file

  1. <?php
  2. error_reporting(E_ALL);
  3. ini_set('display_errors|On');
  4. require_once '../../../bootstrap.php';
  5. use JsonSchema\Constraints\Constraint;
  6. use JsonSchema\Constraints\Factory;
  7. use JsonSchema\SchemaStorage;
  8. use JsonSchema\Validator;
  9. //S-2300
  10. //Campo {cpfDep} – alterada validação da alínea a).
  11. //Campo {racaCor} – alterada descrição dos valores [2, 3, 4].
  12. //Campo {dtChegada} – alterada ocorrência e inserida validação.
  13. //Grupos {cargoFuncao} – alterada condição.
  14. //Grupos {remuneracao} – alterada condição.
  15. $evento = 'evtTSVInicio';
  16. $version = '02_05_00';
  17. $jsonSchema = '{
  18. "title": "evtTSVInicio",
  19. "type": "object",
  20. "properties": {
  21. "sequencial": {
  22. "required": true,
  23. "type": "integer",
  24. "minimum": 1,
  25. "maximum": 99999
  26. },
  27. "indretif": {
  28. "required": true,
  29. "type": "integer",
  30. "minimum": 1,
  31. "maximum": 2
  32. },
  33. "nrrecibo": {
  34. "required": false,
  35. "type": ["string","null"],
  36. "maxLength": 40
  37. },
  38. "cpftrab": {
  39. "required": true,
  40. "type": "string",
  41. "pattern": "^[0-9]{11}$"
  42. },
  43. "nistrab": {
  44. "required": false,
  45. "type": ["string","null"],
  46. "maxLength": 11
  47. },
  48. "nmtrab": {
  49. "required": true,
  50. "type": "string",
  51. "minLength": 3,
  52. "maxLength": 70
  53. },
  54. "sexo": {
  55. "required": true,
  56. "type": "string",
  57. "pattern": "^(F|M)$"
  58. },
  59. "racacor": {
  60. "required": true,
  61. "type": "integer",
  62. "minimum": 1,
  63. "maximum": 6
  64. },
  65. "estciv": {
  66. "required": true,
  67. "type": "integer",
  68. "minimum": 1,
  69. "maximum": 5
  70. },
  71. "grauinstr": {
  72. "required": true,
  73. "type": "string",
  74. "pattern": "^[0-9]{2}$"
  75. },
  76. "nmsoc": {
  77. "required": false,
  78. "type": ["string","null"],
  79. "minLength": 3,
  80. "maxLength": 70
  81. },
  82. "dtnascto": {
  83. "required": true,
  84. "type": "string",
  85. "pattern": "^(19[0-9][0-9]|2[0-9][0-9][0-9])[-/](0?[1-9]|1[0-2])[-/](0?[1-9]|[12][0-9]|3[01])$"
  86. },
  87. "codmunic": {
  88. "required": false,
  89. "type": ["string","null"],
  90. "pattern": "^[0-9]{7}$"
  91. },
  92. "uf": {
  93. "required": false,
  94. "type": ["string","null"],
  95. "pattern": "^(AC|AL|AP|AM|BA|CE|DF|ES|GO|MA|MT|MS|MG|PA|PB|PR|PE|PI|RJ|RN|RS|RO|RR|SC|SP|SE|TO)$"
  96. },
  97. "paisnascto": {
  98. "required": true,
  99. "type": "string",
  100. "pattern": "^[0-9]{3}$"
  101. },
  102. "paisnac": {
  103. "required": true,
  104. "type": "string",
  105. "pattern": "^[0-9]{3}$"
  106. },
  107. "nmmae": {
  108. "required": false,
  109. "type": ["string","null"],
  110. "minLength": 3,
  111. "maxLength": 70
  112. },
  113. "nmpai": {
  114. "required": false,
  115. "type": ["string","null"],
  116. "minLength": 3,
  117. "maxLength": 70
  118. },
  119. "ctps": {
  120. "required": false,
  121. "type": ["object","null"],
  122. "properties": {
  123. "nrctps": {
  124. "required": true,
  125. "type": "string",
  126. "minLength": 3,
  127. "maxLength": 11
  128. },
  129. "seriectps": {
  130. "required": true,
  131. "type": "string",
  132. "minLength": 1,
  133. "maxLength": 5
  134. },
  135. "ufctps": {
  136. "required": true,
  137. "type": "string",
  138. "pattern": "^(AC|AL|AP|AM|BA|CE|DF|ES|GO|MA|MT|MS|MG|PA|PB|PR|PE|PI|RJ|RN|RS|RO|RR|SC|SP|SE|TO)$"
  139. }
  140. }
  141. },
  142. "ric": {
  143. "required": false,
  144. "type": ["object","null"],
  145. "properties": {
  146. "nrric": {
  147. "required": true,
  148. "type": "string",
  149. "minLength": 3,
  150. "maxLength": 14
  151. },
  152. "orgaoemissor": {
  153. "required": true,
  154. "type": "string",
  155. "minLength": 3,
  156. "maxLength": 20
  157. },
  158. "dtexped": {
  159. "required": false,
  160. "type": ["string","null"],
  161. "pattern": "^(19[0-9][0-9]|2[0-9][0-9][0-9])[-/](0?[1-9]|1[0-2])[-/](0?[1-9]|[12][0-9]|3[01])$"
  162. }
  163. }
  164. },
  165. "rg": {
  166. "required": false,
  167. "type": ["object","null"],
  168. "properties": {
  169. "nrrg": {
  170. "required": true,
  171. "type": "string",
  172. "minLength": 3,
  173. "maxLength": 14
  174. },
  175. "orgaoemissor": {
  176. "required": true,
  177. "type": "string",
  178. "minLength": 3,
  179. "maxLength": 20
  180. },
  181. "dtexped": {
  182. "required": false,
  183. "type": ["string","null"],
  184. "pattern": "^(19[0-9][0-9]|2[0-9][0-9][0-9])[-/](0?[1-9]|1[0-2])[-/](0?[1-9]|[12][0-9]|3[01])$"
  185. }
  186. }
  187. },
  188. "rne": {
  189. "required": false,
  190. "type": ["object","null"],
  191. "properties": {
  192. "nrrne": {
  193. "required": true,
  194. "type": "string",
  195. "minLength": 3,
  196. "maxLength": 14
  197. },
  198. "orgaoemissor": {
  199. "required": true,
  200. "type": "string",
  201. "minLength": 3,
  202. "maxLength": 20
  203. },
  204. "dtexped": {
  205. "required": false,
  206. "type": ["string","null"],
  207. "pattern": "^(19[0-9][0-9]|2[0-9][0-9][0-9])[-/](0?[1-9]|1[0-2])[-/](0?[1-9]|[12][0-9]|3[01])$"
  208. }
  209. }
  210. },
  211. "oc": {
  212. "required": false,
  213. "type": ["object","null"],
  214. "properties": {
  215. "nroc": {
  216. "required": true,
  217. "type": "string",
  218. "minLength": 3,
  219. "maxLength": 14
  220. },
  221. "orgaoemissor": {
  222. "required": true,
  223. "type": "string",
  224. "minLength": 3,
  225. "maxLength": 20
  226. },
  227. "dtexped": {
  228. "required": false,
  229. "type": ["string","null"],
  230. "pattern": "^(19[0-9][0-9]|2[0-9][0-9][0-9])[-/](0?[1-9]|1[0-2])[-/](0?[1-9]|[12][0-9]|3[01])$"
  231. },
  232. "dtvalid": {
  233. "required": false,
  234. "type": ["string","null"],
  235. "pattern": "^(19[0-9][0-9]|2[0-9][0-9][0-9])[-/](0?[1-9]|1[0-2])[-/](0?[1-9]|[12][0-9]|3[01])$"
  236. }
  237. }
  238. },
  239. "cnh": {
  240. "required": false,
  241. "type": ["object","null"],
  242. "properties": {
  243. "nrregcnh": {
  244. "required": true,
  245. "type": "string",
  246. "minLength": 3,
  247. "maxLength": 12
  248. },
  249. "dtexped": {
  250. "required": false,
  251. "type": ["string","null"],
  252. "pattern": "^(19[0-9][0-9]|2[0-9][0-9][0-9])[-/](0?[1-9]|1[0-2])[-/](0?[1-9]|[12][0-9]|3[01])$"
  253. },
  254. "ufcnh": {
  255. "required": true,
  256. "type": "string",
  257. "pattern": "^(AC|AL|AP|AM|BA|CE|DF|ES|GO|MA|MT|MS|MG|PA|PB|PR|PE|PI|RJ|RN|RS|RO|RR|SC|SP|SE|TO)$"
  258. },
  259. "dtvalid": {
  260. "required": true,
  261. "type": "string",
  262. "pattern": "^(19[0-9][0-9]|2[0-9][0-9][0-9])[-/](0?[1-9]|1[0-2])[-/](0?[1-9]|[12][0-9]|3[01])$"
  263. },
  264. "dtprihab": {
  265. "required": false,
  266. "type": ["string","null"],
  267. "pattern": "^(19[0-9][0-9]|2[0-9][0-9][0-9])[-/](0?[1-9]|1[0-2])[-/](0?[1-9]|[12][0-9]|3[01])$"
  268. },
  269. "categoriacnh": {
  270. "required": true,
  271. "type": "string",
  272. "pattern": "^(A|B|C|D|E|AB|AC|AD|AE)$"
  273. }
  274. }
  275. },
  276. "brasil": {
  277. "required": false,
  278. "type": ["object","null"],
  279. "properties": {
  280. "tplograd": {
  281. "required": true,
  282. "type": "string",
  283. "minLength": 1,
  284. "maxLength": 4
  285. },
  286. "dsclograd": {
  287. "required": true,
  288. "type": "string",
  289. "minLength": 3,
  290. "maxLength": 80
  291. },
  292. "nrlograd": {
  293. "required": true,
  294. "type": "string",
  295. "minLength": 1,
  296. "maxLength": 10
  297. },
  298. "complemento": {
  299. "required": false,
  300. "type": ["string","null"],
  301. "minLength": 3,
  302. "maxLength": 30
  303. },
  304. "bairro": {
  305. "required": false,
  306. "type": ["string","null"],
  307. "minLength": 3,
  308. "maxLength": 60
  309. },
  310. "cep": {
  311. "required": true,
  312. "type": "string",
  313. "pattern": "^[0-9]{8}$"
  314. },
  315. "codmunic": {
  316. "required": true,
  317. "type": "string",
  318. "pattern": "^[0-9]{7}$"
  319. },
  320. "uf": {
  321. "required": true,
  322. "type": "string",
  323. "pattern": "^(AC|AL|AP|AM|BA|CE|DF|ES|GO|MA|MT|MS|MG|PA|PB|PR|PE|PI|RJ|RN|RS|RO|RR|SC|SP|SE|TO)$"
  324. }
  325. }
  326. },
  327. "exterior": {
  328. "required": false,
  329. "type": ["object","null"],
  330. "properties": {
  331. "paisresid": {
  332. "required": true,
  333. "type": "string",
  334. "pattern": "^[0-9]{3}$"
  335. },
  336. "dsclograd": {
  337. "required": true,
  338. "type": "string",
  339. "minLength": 3,
  340. "maxLength": 80
  341. },
  342. "nrlograd": {
  343. "required": true,
  344. "type": "string",
  345. "minLength": 1,
  346. "maxLength": 10
  347. },
  348. "complemento": {
  349. "required": false,
  350. "type": ["string","null"],
  351. "minLength": 3,
  352. "maxLength": 30
  353. },
  354. "bairro": {
  355. "required": false,
  356. "type": ["string","null"],
  357. "minLength": 3,
  358. "maxLength": 60
  359. },
  360. "nmcid": {
  361. "required": true,
  362. "type": "string",
  363. "minLength": 3,
  364. "maxLength": 50
  365. },
  366. "codpostal": {
  367. "required": false,
  368. "type": ["string","null"],
  369. "minLength": 1,
  370. "maxLength": 12
  371. }
  372. }
  373. },
  374. "trabestrangeiro": {
  375. "required": false,
  376. "type": ["object","null"],
  377. "properties": {
  378. "dtchegada": {
  379. "required": false,
  380. "type": ["string","null"],
  381. "pattern": "^(19[0-9][0-9]|2[0-9][0-9][0-9])[-/](0?[1-9]|1[0-2])[-/](0?[1-9]|[12][0-9]|3[01])$"
  382. },
  383. "classtrabestrang": {
  384. "required": true,
  385. "type": "integer",
  386. "minimum": 1,
  387. "maximum": 12
  388. },
  389. "casadobr": {
  390. "required": true,
  391. "type": "string",
  392. "pattern": "^(S|N)$"
  393. },
  394. "filhosbr": {
  395. "required": true,
  396. "type": "string",
  397. "pattern": "^(S|N)$"
  398. }
  399. }
  400. },
  401. "infodeficiencia": {
  402. "required": false,
  403. "type": ["object","null"],
  404. "properties": {
  405. "deffisica": {
  406. "required": true,
  407. "type": "string",
  408. "pattern": "^(S|N)$"
  409. },
  410. "defvisual": {
  411. "required": true,
  412. "type": "string",
  413. "pattern": "^(S|N)$"
  414. },
  415. "defauditiva": {
  416. "required": true,
  417. "type": "string",
  418. "pattern": "^(S|N)$"
  419. },
  420. "defmental": {
  421. "required": true,
  422. "type": "string",
  423. "pattern": "^(S|N)$"
  424. },
  425. "defintelectual": {
  426. "required": true,
  427. "type": "string",
  428. "pattern": "^(S|N)$"
  429. },
  430. "reabreadap": {
  431. "required": true,
  432. "type": "string",
  433. "pattern": "^(S|N)$"
  434. },
  435. "observacao": {
  436. "required": false,
  437. "type": ["string","null"],
  438. "minLength": 3,
  439. "maxLength": 255
  440. }
  441. }
  442. },
  443. "dependente": {
  444. "required": false,
  445. "type": ["array","null"],
  446. "minItems": 0,
  447. "maxItems": 99,
  448. "items": {
  449. "type": "object",
  450. "properties": {
  451. "tpdep": {
  452. "required": true,
  453. "type": "string",
  454. "pattern": "^[0-9]{2}$"
  455. },
  456. "nmdep": {
  457. "required": true,
  458. "type": "string",
  459. "minLength": 3,
  460. "maxLength": 70
  461. },
  462. "dtnascto": {
  463. "required": true,
  464. "type": "string",
  465. "pattern": "^(19[0-9][0-9]|2[0-9][0-9][0-9])[-/](0?[1-9]|1[0-2])[-/](0?[1-9]|[12][0-9]|3[01])$"
  466. },
  467. "cpfdep": {
  468. "required": false,
  469. "type": ["string","null"],
  470. "pattern": "^[0-9]{11}$"
  471. },
  472. "depirrf": {
  473. "required": true,
  474. "type": "string",
  475. "pattern": "^(S|N)$"
  476. },
  477. "depsf": {
  478. "required": true,
  479. "type": "string",
  480. "pattern": "^(S|N)$"
  481. },
  482. "inctrab": {
  483. "required": true,
  484. "type": "string",
  485. "pattern": "^(S|N)$"
  486. }
  487. }
  488. }
  489. },
  490. "contato": {
  491. "required": false,
  492. "type": ["object","null"],
  493. "properties": {
  494. "foneprinc": {
  495. "required": false,
  496. "type": ["string","null"],
  497. "pattern": "^[0-9]{10,13}$"
  498. },
  499. "fonealternat": {
  500. "required": false,
  501. "type": ["string","null"],
  502. "pattern": "^[0-9]{10,13}$"
  503. },
  504. "emailprinc": {
  505. "required": false,
  506. "type": ["string","null"],
  507. "format": "email"
  508. },
  509. "emailalternat": {
  510. "required": false,
  511. "type": ["string","null"],
  512. "format": "email"
  513. }
  514. }
  515. },
  516. "infotsvinicio": {
  517. "required": true,
  518. "type": "object",
  519. "properties": {
  520. "cadini": {
  521. "required": true,
  522. "type": "string",
  523. "pattern": "^(S|N)$"
  524. },
  525. "codcateg": {
  526. "required": true,
  527. "type": "string",
  528. "pattern": "^[0-9]{3}$"
  529. },
  530. "dtinicio": {
  531. "required": true,
  532. "type": "string",
  533. "pattern": "^(19[0-9][0-9]|2[0-9][0-9][0-9])[-/](0?[1-9]|1[0-2])[-/](0?[1-9]|[12][0-9]|3[01])$"
  534. },
  535. "natatividade": {
  536. "required": false,
  537. "type": "integer",
  538. "minimum": 1,
  539. "maximum": 2
  540. }
  541. }
  542. },
  543. "cargofuncao": {
  544. "required": false,
  545. "type": ["object","null"],
  546. "properties": {
  547. "codcargo": {
  548. "required": true,
  549. "type": "string",
  550. "minLength": 1,
  551. "maxLength": 30
  552. },
  553. "codfuncao": {
  554. "required": false,
  555. "type": ["string","null"],
  556. "minLength": 1,
  557. "maxLength": 30
  558. }
  559. }
  560. },
  561. "remuneracao": {
  562. "required": false,
  563. "type": ["object","null"],
  564. "properties": {
  565. "vrsalfx": {
  566. "required": true,
  567. "type": "number"
  568. },
  569. "undsalfixo": {
  570. "required": true,
  571. "type": "integer",
  572. "minimum": 1,
  573. "maximum": 7
  574. },
  575. "dscsalvar": {
  576. "required": false,
  577. "type": ["string","null"],
  578. "minLength": 3,
  579. "maxLength": 255
  580. }
  581. }
  582. },
  583. "fgts": {
  584. "required": false,
  585. "type": ["object","null"],
  586. "properties": {
  587. "opcfgts": {
  588. "required": true,
  589. "type": "integer",
  590. "minimum": 1,
  591. "maximum": 2
  592. },
  593. "dtopcfgts": {
  594. "required": false,
  595. "type": ["string","null"],
  596. "pattern": "^(19[0-9][0-9]|2[0-9][0-9][0-9])[-/](0?[1-9]|1[0-2])[-/](0?[1-9]|[12][0-9]|3[01])$"
  597. }
  598. }
  599. },
  600. "infodirigentesindical": {
  601. "required": false,
  602. "type": ["object","null"],
  603. "properties": {
  604. "categorig": {
  605. "required": true,
  606. "type": "string",
  607. "pattern": "^[0-9]{3}$"
  608. },
  609. "cnpjorigem": {
  610. "required": false,
  611. "type": ["string","null"],
  612. "pattern": "^[0-9]{14}$"
  613. },
  614. "dtadmorig": {
  615. "required": false,
  616. "type": ["string","null"],
  617. "pattern": "^(19[0-9][0-9]|2[0-9][0-9][0-9])[-/](0?[1-9]|1[0-2])[-/](0?[1-9]|[12][0-9]|3[01])$"
  618. },
  619. "matricorig": {
  620. "required": false,
  621. "type": ["string","null"],
  622. "minLength": 1,
  623. "maxLength": 30
  624. }
  625. }
  626. },
  627. "infotrabcedido": {
  628. "required": false,
  629. "type": ["object","null"],
  630. "properties": {
  631. "categorig": {
  632. "required": true,
  633. "type": "string",
  634. "pattern": "^[0-9]{3}$"
  635. },
  636. "cnpjcednt": {
  637. "required": true,
  638. "type": "string",
  639. "pattern": "^[0-9]{14}$"
  640. },
  641. "matricced": {
  642. "required": true,
  643. "type": "string",
  644. "minLength": 1,
  645. "maxLength": 30
  646. },
  647. "dtadmced": {
  648. "required": true,
  649. "type": "string",
  650. "pattern": "^(19[0-9][0-9]|2[0-9][0-9][0-9])[-/](0?[1-9]|1[0-2])[-/](0?[1-9]|[12][0-9]|3[01])$"
  651. },
  652. "tpregtrab": {
  653. "required": true,
  654. "type": "integer",
  655. "minimum": 1,
  656. "maximum": 2
  657. },
  658. "tpregprev": {
  659. "required": true,
  660. "type": "integer",
  661. "minimum": 1,
  662. "maximum": 3
  663. },
  664. "infonus": {
  665. "required": true,
  666. "type": "integer",
  667. "minimum": 1,
  668. "maximum": 3
  669. }
  670. }
  671. },
  672. "infoestagiario": {
  673. "required": false,
  674. "type": ["object","null"],
  675. "properties": {
  676. "natestagio": {
  677. "required": true,
  678. "type": "string",
  679. "pattern": "^(O|N)$"
  680. },
  681. "nivestagio": {
  682. "required": true,
  683. "type": "integer",
  684. "minimum": 1,
  685. "maximum": 9
  686. },
  687. "areaatuacao": {
  688. "required": false,
  689. "type": ["string","null"],
  690. "minLength": 3,
  691. "maxLength": 50
  692. },
  693. "nrapol": {
  694. "required": false,
  695. "type": ["string","null"],
  696. "minLength": 1,
  697. "maxLength": 30
  698. },
  699. "vlrbolsa": {
  700. "required": false,
  701. "type": ["number","null"]
  702. },
  703. "dtprevterm": {
  704. "required": true,
  705. "type": "string",
  706. "pattern": "^(19[0-9][0-9]|2[0-9][0-9][0-9])[-/](0?[1-9]|1[0-2])[-/](0?[1-9]|[12][0-9]|3[01])$"
  707. },
  708. "instensino": {
  709. "required": true,
  710. "type": "object",
  711. "properties": {
  712. "cnpjinstensino": {
  713. "required": false,
  714. "type": ["string","null"],
  715. "pattern": "^[0-9]{14}$"
  716. },
  717. "nmrazao": {
  718. "required": true,
  719. "type": "string",
  720. "minLength": 3,
  721. "maxLength": 100
  722. },
  723. "dsclograd": {
  724. "required": false,
  725. "type": ["string","null"],
  726. "minLength": 1,
  727. "maxLength": 80
  728. },
  729. "nrlograd": {
  730. "required": false,
  731. "type": ["string","null"],
  732. "minLength": 1,
  733. "maxLength": 10
  734. },
  735. "bairro": {
  736. "required": false,
  737. "type": ["string","null"],
  738. "minLength": 1,
  739. "maxLength": 60
  740. },
  741. "cep": {
  742. "required": false,
  743. "type": ["string","null"],
  744. "pattern": "^[0-9]{8}$"
  745. },
  746. "codmunic": {
  747. "required": false,
  748. "type": ["string","null"],
  749. "pattern": "^[0-9]{7}"
  750. },
  751. "uf": {
  752. "required": false,
  753. "type": ["string","null"],
  754. "pattern": "^(AC|AL|AP|AM|BA|CE|DF|ES|GO|MA|MT|MS|MG|PA|PB|PR|PE|PI|RJ|RN|RS|RO|RR|SC|SP|SE|TO)$"
  755. }
  756. }
  757. },
  758. "ageintegracao": {
  759. "required": false,
  760. "type": ["object","null"],
  761. "properties": {
  762. "cnpjagntinteg": {
  763. "required": true,
  764. "type": "string",
  765. "pattern": "^[0-9]{14}$"
  766. },
  767. "nmrazao": {
  768. "required": true,
  769. "type": "string",
  770. "minLength": 3,
  771. "maxLength": 100
  772. },
  773. "dsclograd": {
  774. "required": true,
  775. "type": "string",
  776. "minLength": 1,
  777. "maxLength": 80
  778. },
  779. "nrlograd": {
  780. "required": true,
  781. "type": "string",
  782. "minLength": 1,
  783. "maxLength": 10
  784. },
  785. "bairro": {
  786. "required": false,
  787. "type": ["string","null"],
  788. "minLength": 1,
  789. "maxLength": 60
  790. },
  791. "cep": {
  792. "required": true,
  793. "type": "string",
  794. "pattern": "^[0-9]{8}$"
  795. },
  796. "codmunic": {
  797. "required": false,
  798. "type": ["string","null"],
  799. "pattern": "^[0-9]{7}$"
  800. },
  801. "uf": {
  802. "required": true,
  803. "type": "string",
  804. "pattern": "^(AC|AL|AP|AM|BA|CE|DF|ES|GO|MA|MT|MS|MG|PA|PB|PR|PE|PI|RJ|RN|RS|RO|RR|SC|SP|SE|TO)$"
  805. }
  806. }
  807. },
  808. "supervisorestagio": {
  809. "required": false,
  810. "type": ["object","null"],
  811. "properties": {
  812. "cpfsupervisor": {
  813. "required": true,
  814. "type": "string",
  815. "pattern": "^[0-9]{11}$"
  816. },
  817. "nmsuperv": {
  818. "required": true,
  819. "type": "string",
  820. "minLength": 3,
  821. "maxLength": 70
  822. }
  823. }
  824. }
  825. }
  826. },
  827. "mudancacpf": {
  828. "required": false,
  829. "type": ["object","null"],
  830. "properties": {
  831. "cpfant": {
  832. "required": true,
  833. "type": "string",
  834. "pattern": "^[0-9]{11}$"
  835. },
  836. "dtaltcpf": {
  837. "required": true,
  838. "type": "string",
  839. "pattern": "^(19[0-9][0-9]|2[0-9][0-9][0-9])[-/](0?[1-9]|1[0-2])[-/](0?[1-9]|[12][0-9]|3[01])$"
  840. },
  841. "observacao": {
  842. "required": false,
  843. "type": ["string","null"],
  844. "maxLength": 255
  845. }
  846. }
  847. },
  848. "afastamento": {
  849. "required": false,
  850. "type": ["object","null"],
  851. "properties": {
  852. "dtiniafast": {
  853. "required": true,
  854. "type": "string",
  855. "pattern": "^(19[0-9][0-9]|2[0-9][0-9][0-9])[-/](0?[1-9]|1[0-2])[-/](0?[1-9]|[12][0-9]|3[01])$"
  856. },
  857. "codmotafast": {
  858. "required": true,
  859. "type": "string",
  860. "pattern": "^[0-9]{2}"
  861. }
  862. }
  863. },
  864. "termino": {
  865. "required": false,
  866. "type": ["object","null"],
  867. "properties": {
  868. "dtterm": {
  869. "required": true,
  870. "type": "string",
  871. "pattern": "^(19[0-9][0-9]|2[0-9][0-9][0-9])[-/](0?[1-9]|1[0-2])[-/](0?[1-9]|[12][0-9]|3[01])$"
  872. }
  873. }
  874. }
  875. }
  876. }';
  877. $std = new \stdClass();
  878. $std->sequencial = 1;
  879. $std->indretif = 1;
  880. $std->nrrecibo = 'ABJBAJBJAJBAÇÇAAKJ';
  881. $std->cpftrab = '12345678901';
  882. $std->nistrab = '1234';
  883. $std->nmtrab = 'Fulano de Tal';
  884. $std->sexo = 'M';
  885. $std->racacor = 2;
  886. $std->estciv = 3;
  887. $std->grauinstr = '03';
  888. $std->nmsoc = 'Fulano de Tal';
  889. $std->dtnascto = '1996-06-11';
  890. $std->codmunic = '1234567';
  891. $std->uf = 'AC';
  892. $std->paisnascto = '105';
  893. $std->paisnac = '105';
  894. $std->nmmae = 'Maria de Tal';
  895. $std->nmpai = "Joao de Tal";
  896. //documentos
  897. $std->ctps = new \stdClass();
  898. $std->ctps->nrctps = '11215454';
  899. $std->ctps->seriectps = '011';
  900. $std->ctps->ufctps = 'AC';
  901. $std->ric = new \stdClass();
  902. $std->ric->nrric = '28282828';
  903. $std->ric->orgaoemissor = 'sslkjslkjslksj';
  904. $std->ric->dtexped = '2011-07-07';
  905. $std->rg = new \stdClass();
  906. $std->rg->nrrg = '1234567';
  907. $std->rg->orgaoemissor = 'sslkslkslks';
  908. $std->rg->dtexped = '2011-06-06';
  909. $std->rne = new \stdClass();
  910. $std->rne->nrrne = '8829822982982';
  911. $std->rne->orgaoemissor = 'slkslsklsklsk';
  912. $std->rne->dtexped = '2011-08-08';
  913. $std->oc = new \stdClass();
  914. $std->oc->nroc = '1929282882828';
  915. $std->oc->orgaoemissor = 'lslslsls';
  916. $std->oc->dtexped = '2011-10-10';
  917. $std->oc->dtvalid = '2022-10-10';
  918. $std->cnh = new \stdClass();
  919. $std->cnh->nrregcnh = '123456789012';
  920. $std->cnh->dtexped = '2017-05-05';
  921. $std->cnh->ufcnh = 'AC';
  922. $std->cnh->dtvalid = '2022-05-05';
  923. $std->cnh->dtprihab = '2011-01-01';
  924. $std->cnh->categoriacnh = 'AB';
  925. //endereço
  926. $std->brasil = new \stdClass();
  927. $std->brasil->tplograd = 'av';
  928. $std->brasil->dsclograd = 'slkslkslkslsk';
  929. $std->brasil->nrlograd = 'sksks';
  930. $std->brasil->complemento = 'owpososomsmm';
  931. $std->brasil->bairro = 'sksksksk';
  932. $std->brasil->cep = '12345678';
  933. $std->brasil->codmunic = '1234567';
  934. $std->brasil->uf = 'AC';
  935. $std->exterior = new \stdClass();
  936. $std->exterior->paisresid = '158';
  937. $std->exterior->dsclograd = 'kkssjksjsk';
  938. $std->exterior->nrlograd = '1112sss';
  939. $std->exterior->complemento = 'lslslsls';
  940. $std->exterior->bairro = 'lslslsl';
  941. $std->exterior->nmcid = 'slkskslks';
  942. $std->exterior->codpostal = '1234';
  943. $std->trabestrangeiro = new \stdClass();
  944. $std->trabestrangeiro->dtchegada = '2015-11-11';
  945. $std->trabestrangeiro->classtrabestrang = 12;
  946. $std->trabestrangeiro->casadobr = 'N';
  947. $std->trabestrangeiro->filhosbr = 'N';
  948. $std->infodeficiencia = new \stdClass();
  949. $std->infodeficiencia->deffisica = 'N';
  950. $std->infodeficiencia->defvisual = 'N';
  951. $std->infodeficiencia->defauditiva = 'N';
  952. $std->infodeficiencia->defmental = 'N';
  953. $std->infodeficiencia->defintelectual = 'N';
  954. $std->infodeficiencia->reabreadap = 'N';
  955. $std->infodeficiencia->observacao = 'lkslkslkslkslkslks';
  956. $std->dependente[1] = new \stdClass();
  957. $std->dependente[1]->tpdep = '01';
  958. $std->dependente[1]->nmdep = 'Fulaninho de Tal';
  959. $std->dependente[1]->dtnascto = '2016-11-25';
  960. $std->dependente[1]->cpfdep = '12345678901';
  961. $std->dependente[1]->depirrf = 'N';
  962. $std->dependente[1]->depsf = 'N';
  963. $std->dependente[1]->inctrab = 'N';
  964. $std->contato = new \stdClass();
  965. $std->contato->foneprinc = '1234567890';
  966. $std->contato->fonealternat = '0912345678';
  967. $std->contato->emailprinc = 'ele@mail.com';
  968. $std->contato->emailalternat = 'ela@email.com.br';
  969. $std->infotsvinicio = new \stdClass();
  970. $std->infotsvinicio->cadini = 'S';
  971. $std->infotsvinicio->codcateg = '101';
  972. $std->infotsvinicio->dtinicio = '2017-05-12';
  973. $std->infotsvinicio->natatividade = 2;
  974. $std->cargofuncao = new \stdClass();
  975. $std->cargofuncao->codcargo = 'oaoaoa';
  976. $std->cargofuncao->codfuncao = 'ksksksksk sk';
  977. $std->remuneracao = new \stdClass();
  978. $std->remuneracao->vrsalfx = 1200.00;
  979. $std->remuneracao->undsalfixo = 7;
  980. $std->remuneracao->dscsalvar = 'lkklslskksl s lks lsklsks ';
  981. $std->fgts = new \stdClass();
  982. $std->fgts->opcfgts = 1;
  983. $std->fgts->dtopcfgts = '2017-05-12';
  984. $std->infodirigentesindical = new \stdClass();
  985. $std->infodirigentesindical->categorig = '001';
  986. $std->infodirigentesindical->cnpjorigem = '12345678901234';
  987. $std->infodirigentesindical->dtadmorig = '2017-05-12';
  988. $std->infodirigentesindical->matricorig = 'ytuytuystyst';
  989. $std->infotrabcedido = new \stdClass();
  990. $std->infotrabcedido->categorig = '001';
  991. $std->infotrabcedido->cnpjcednt = '12345678901234';
  992. $std->infotrabcedido->matricced = 'lksçkçslksl';
  993. $std->infotrabcedido->dtadmced = '2017-05-12';
  994. $std->infotrabcedido->tpregtrab = 2;
  995. $std->infotrabcedido->tpregprev = 3;
  996. $std->infotrabcedido->infonus = 3;
  997. $std->infoestagiario = new \stdClass();
  998. $std->infoestagiario->natestagio = 'N';
  999. $std->infoestagiario->nivestagio = 8;
  1000. $std->infoestagiario->areaatuacao = 'ksksksksk';
  1001. $std->infoestagiario->nrapol = 'kak228282828';
  1002. $std->infoestagiario->vlrbolsa = 1200.00;
  1003. $std->infoestagiario->dtprevterm = '2017-12-31';
  1004. $std->infoestagiario->instensino = new \stdClass();
  1005. $std->infoestagiario->instensino->cnpjinstensino = '12345678901234';
  1006. $std->infoestagiario->instensino->nmrazao = 'dlkdldkldkd';
  1007. $std->infoestagiario->instensino->dsclograd = 'lslsppopapap';
  1008. $std->infoestagiario->instensino->nrlograd = '12244';
  1009. $std->infoestagiario->instensino->bairro = 'kakakaka';
  1010. $std->infoestagiario->instensino->cep = '12345678';
  1011. $std->infoestagiario->instensino->codmunic = '1234567';
  1012. $std->infoestagiario->instensino->uf = 'AC';
  1013. $std->infoestagiario->ageintegracao = new \stdClass();
  1014. $std->infoestagiario->ageintegracao->cnpjagntinteg = '12345678901234';
  1015. $std->infoestagiario->ageintegracao->nmrazao = 'mamaamamamam';
  1016. $std->infoestagiario->ageintegracao->dsclograd = 'oaoaoaoao';
  1017. $std->infoestagiario->ageintegracao->nrlograd = 'msmsmsmsms';
  1018. $std->infoestagiario->ageintegracao->bairro = 'lslslslsl';
  1019. $std->infoestagiario->ageintegracao->cep = '12345678';
  1020. $std->infoestagiario->ageintegracao->codmunic = '1234567';
  1021. $std->infoestagiario->ageintegracao->uf = 'AC';
  1022. $std->infoestagiario->supervisorestagio = new \stdClass();
  1023. $std->infoestagiario->supervisorestagio->cpfsupervisor = '12345678901';
  1024. $std->infoestagiario->supervisorestagio->nmsuperv = 'lksklskslkslkslk slkslkslkskslk';
  1025. $std->mudancacpf = new \stdClass();
  1026. $std->mudancacpf->cpfant = '12345678901';
  1027. $std->mudancacpf->dtaltcpf = '2018-11-10';
  1028. $std->mudancacpf->observacao = 'bla bla bla';
  1029. $std->afastamento = new \stdClass();
  1030. $std->afastamento->dtiniafast = '2017-06-01';
  1031. $std->afastamento->codmotafast = '01';
  1032. $std->termino = new \stdClass();
  1033. $std->termino->dtterm = '2017-12-31';
  1034. // Schema must be decoded before it can be used for validation
  1035. $jsonSchemaObject = json_decode($jsonSchema);
  1036. if (empty($jsonSchemaObject)) {
  1037. echo "<h2>Erro de digitação no schema ! Revise</h2>";
  1038. echo "<pre>";
  1039. print_r($jsonSchema);
  1040. echo "</pre>";
  1041. die();
  1042. }
  1043. // The SchemaStorage can resolve references, loading additional schemas from file as needed, etc.
  1044. $schemaStorage = new SchemaStorage();
  1045. // This does two things:
  1046. // 1) Mutates $jsonSchemaObject to normalize the references (to file://mySchema#/definitions/integerData, etc)
  1047. // 2) Tells $schemaStorage that references to file://mySchema... should be resolved by looking in $jsonSchemaObject
  1048. $definitions = realpath(__DIR__."/../../../jsonSchemes/definitions.schema");
  1049. $schemaStorage->addSchema("file:{$definitions}", $jsonSchemaObject);
  1050. // Provide $schemaStorage to the Validator so that references can be resolved during validation
  1051. $jsonValidator = new Validator(new Factory($schemaStorage));
  1052. // Do validation (use isValid() and getErrors() to check the result)
  1053. $jsonValidator->validate(
  1054. $std,
  1055. $jsonSchemaObject,
  1056. Constraint::CHECK_MODE_COERCE_TYPES //tenta converter o dado no tipo indicado no schema
  1057. );
  1058. if ($jsonValidator->isValid()) {
  1059. echo "The supplied JSON validates against the schema.<br/>";
  1060. } else {
  1061. echo "JSON does not validate. Violations:<br/>";
  1062. foreach ($jsonValidator->getErrors() as $error) {
  1063. echo sprintf("[%s] %s<br/>", $error['property'], $error['message']);
  1064. }
  1065. die;
  1066. }
  1067. //salva se sucesso
  1068. file_put_contents("../../../jsonSchemes/v_$version/$evento.schema", $jsonSchema);