@diplodoc/cli-tests 5.15.3 → 5.15.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/e2e/__snapshots__/translation.spec.ts.snap +209 -0
- package/e2e/translation.spec.ts +18 -0
- package/fixtures/cliAdapter.ts +1 -1
- package/mocks/translation/compose/input/openapi-spec.yaml.skl +41 -0
- package/mocks/translation/compose/input/openapi-spec.yaml.xliff +52 -0
- package/mocks/translation/compose/input/toc.yaml.skl +8 -0
- package/mocks/translation/compose/input/toc.yaml.xliff +16 -0
- package/mocks/translation/custom-schema/custom-openapi-schema-30.yaml +1054 -0
- package/mocks/translation/custom-schema/input/openapi-spec.yaml +42 -0
- package/mocks/translation/custom-schema/input/toc.yaml +8 -0
- package/package.json +1 -1
|
@@ -622,6 +622,86 @@ path: toc.yaml
|
|
|
622
622
|
"
|
|
623
623
|
`;
|
|
624
624
|
|
|
625
|
+
exports[`Translate command > compose openapi spec files > filelist 1`] = `
|
|
626
|
+
"[
|
|
627
|
+
"openapi-spec.yaml",
|
|
628
|
+
"toc.yaml"
|
|
629
|
+
]"
|
|
630
|
+
`;
|
|
631
|
+
|
|
632
|
+
exports[`Translate command > compose openapi spec files 1`] = `
|
|
633
|
+
"openapi: 3.0.1
|
|
634
|
+
info:
|
|
635
|
+
title: Перевод 1
|
|
636
|
+
version: v0
|
|
637
|
+
servers:
|
|
638
|
+
- url: http://localhost:8080
|
|
639
|
+
description: Перевод 2
|
|
640
|
+
paths:
|
|
641
|
+
/test:
|
|
642
|
+
get:
|
|
643
|
+
tags:
|
|
644
|
+
- Перевод 3
|
|
645
|
+
summary: Перевод 4
|
|
646
|
+
description: Перевод 5
|
|
647
|
+
operationId: getWithPayloadResponse
|
|
648
|
+
responses:
|
|
649
|
+
'200':
|
|
650
|
+
description: Перевод 6
|
|
651
|
+
content:
|
|
652
|
+
application/json:
|
|
653
|
+
schema:
|
|
654
|
+
type: object
|
|
655
|
+
properties:
|
|
656
|
+
A:
|
|
657
|
+
type: string
|
|
658
|
+
description: |
|
|
659
|
+
Перевод 7
|
|
660
|
+
- Перевод 8
|
|
661
|
+
- Перевод 9
|
|
662
|
+
- Перевод 10
|
|
663
|
+
components:
|
|
664
|
+
schemas:
|
|
665
|
+
RecurceTop:
|
|
666
|
+
type: object
|
|
667
|
+
properties:
|
|
668
|
+
A:
|
|
669
|
+
type: string
|
|
670
|
+
description: |
|
|
671
|
+
Перевод 7
|
|
672
|
+
- Перевод 8
|
|
673
|
+
- Перевод 9
|
|
674
|
+
- Перевод 10
|
|
675
|
+
RecurceMiddle:
|
|
676
|
+
type: object
|
|
677
|
+
properties:
|
|
678
|
+
B:
|
|
679
|
+
type: array
|
|
680
|
+
items:
|
|
681
|
+
type: object
|
|
682
|
+
properties:
|
|
683
|
+
A:
|
|
684
|
+
type: string
|
|
685
|
+
description: |
|
|
686
|
+
Перевод 7
|
|
687
|
+
- Перевод 8
|
|
688
|
+
- Перевод 9
|
|
689
|
+
- Перевод 10
|
|
690
|
+
"
|
|
691
|
+
`;
|
|
692
|
+
|
|
693
|
+
exports[`Translate command > compose openapi spec files 2`] = `
|
|
694
|
+
"items:
|
|
695
|
+
- name: Перевод 1
|
|
696
|
+
include:
|
|
697
|
+
path: openapi
|
|
698
|
+
includers:
|
|
699
|
+
- name: openapi
|
|
700
|
+
input: openapi-spec.yaml
|
|
701
|
+
mode: link
|
|
702
|
+
"
|
|
703
|
+
`;
|
|
704
|
+
|
|
625
705
|
exports[`Translate command > do not filter files on extract > filelist 1`] = `
|
|
626
706
|
"[
|
|
627
707
|
"es/_includes/test.md.skl",
|
|
@@ -862,6 +942,135 @@ exports[`Translate command > extract openapi spec files 4`] = `
|
|
|
862
942
|
</xliff>"
|
|
863
943
|
`;
|
|
864
944
|
|
|
945
|
+
exports[`Translate command > extract openapi spec files with custom openapi schema provided > filelist 1`] = `
|
|
946
|
+
"[
|
|
947
|
+
"openapi-spec.yaml.skl",
|
|
948
|
+
"openapi-spec.yaml.xliff",
|
|
949
|
+
"toc.yaml.skl",
|
|
950
|
+
"toc.yaml.xliff"
|
|
951
|
+
]"
|
|
952
|
+
`;
|
|
953
|
+
|
|
954
|
+
exports[`Translate command > extract openapi spec files with custom openapi schema provided 1`] = `
|
|
955
|
+
"openapi: 3.0.1
|
|
956
|
+
info:
|
|
957
|
+
title: '%%%0%%%'
|
|
958
|
+
version: v0
|
|
959
|
+
servers:
|
|
960
|
+
- url: http://localhost:8080
|
|
961
|
+
description: '%%%1%%%'
|
|
962
|
+
paths:
|
|
963
|
+
/test:
|
|
964
|
+
get:
|
|
965
|
+
tags:
|
|
966
|
+
- '%%%2%%%'
|
|
967
|
+
summary: '%%%3%%%'
|
|
968
|
+
description: '%%%4%%%'
|
|
969
|
+
operationId: getWithPayloadResponse
|
|
970
|
+
responses:
|
|
971
|
+
'200':
|
|
972
|
+
description: '%%%5%%%'
|
|
973
|
+
content:
|
|
974
|
+
application/json:
|
|
975
|
+
schema:
|
|
976
|
+
$ref: '#/components/schemas/RecurceTop'
|
|
977
|
+
components:
|
|
978
|
+
schemas:
|
|
979
|
+
RecurceTop:
|
|
980
|
+
type: object
|
|
981
|
+
properties:
|
|
982
|
+
A:
|
|
983
|
+
type: string
|
|
984
|
+
description: |
|
|
985
|
+
%%%6%%%
|
|
986
|
+
- %%%7%%%
|
|
987
|
+
- %%%8%%%
|
|
988
|
+
- %%%9%%%
|
|
989
|
+
RecurceMiddle:
|
|
990
|
+
type: object
|
|
991
|
+
properties:
|
|
992
|
+
B:
|
|
993
|
+
type: array
|
|
994
|
+
items:
|
|
995
|
+
$ref: '#/components/schemas/RecurceTop'
|
|
996
|
+
"
|
|
997
|
+
`;
|
|
998
|
+
|
|
999
|
+
exports[`Translate command > extract openapi spec files with custom openapi schema provided 2`] = `
|
|
1000
|
+
"<?xml version="1.0" encoding="UTF-8"?>
|
|
1001
|
+
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2">
|
|
1002
|
+
<file original="file.ext" source-language="ru-RU" target-language="es-ES" datatype="markdown">
|
|
1003
|
+
<header>
|
|
1004
|
+
<skeleton>
|
|
1005
|
+
<external-file href="file.skl"></external-file>
|
|
1006
|
+
</skeleton>
|
|
1007
|
+
</header>
|
|
1008
|
+
<body>
|
|
1009
|
+
<trans-unit id="0">
|
|
1010
|
+
<source xml:space="preserve">OpenAPI definition</source>
|
|
1011
|
+
</trans-unit>
|
|
1012
|
+
<trans-unit id="1">
|
|
1013
|
+
<source xml:space="preserve">Generated server url</source>
|
|
1014
|
+
</trans-unit>
|
|
1015
|
+
<trans-unit id="2">
|
|
1016
|
+
<source xml:space="preserve">test-controller</source>
|
|
1017
|
+
</trans-unit>
|
|
1018
|
+
<trans-unit id="3">
|
|
1019
|
+
<source xml:space="preserve">Simple get operation. тест новой верстки 3</source>
|
|
1020
|
+
</trans-unit>
|
|
1021
|
+
<trans-unit id="4">
|
|
1022
|
+
<source xml:space="preserve">Defines a simple get operation with no inputs and a complex</source>
|
|
1023
|
+
</trans-unit>
|
|
1024
|
+
<trans-unit id="5">
|
|
1025
|
+
<source xml:space="preserve">200!!!!</source>
|
|
1026
|
+
</trans-unit>
|
|
1027
|
+
<trans-unit id="6">
|
|
1028
|
+
<source xml:space="preserve">Статус загрузки:</source>
|
|
1029
|
+
</trans-unit>
|
|
1030
|
+
<trans-unit id="7">
|
|
1031
|
+
<source xml:space="preserve"><x ctype="code_open" equiv-text="\`" id="x-1"/>UPLOADED<x ctype="code_close" equiv-text="\`" id="x-2"/> — загрузка завершена.</source>
|
|
1032
|
+
</trans-unit>
|
|
1033
|
+
<trans-unit id="8">
|
|
1034
|
+
<source xml:space="preserve"><x ctype="code_open" equiv-text="\`" id="x-3"/>IN_PROGRESS<x ctype="code_close" equiv-text="\`" id="x-4"/> — загрузка находится в процессе обработки.</source>
|
|
1035
|
+
</trans-unit>
|
|
1036
|
+
<trans-unit id="9">
|
|
1037
|
+
<source xml:space="preserve"><x ctype="code_open" equiv-text="\`" id="x-5"/>PROCESSED<x ctype="code_close" equiv-text="\`" id="x-6"/> — загрузка успешно обработана.</source>
|
|
1038
|
+
</trans-unit>
|
|
1039
|
+
</body>
|
|
1040
|
+
</file>
|
|
1041
|
+
</xliff>"
|
|
1042
|
+
`;
|
|
1043
|
+
|
|
1044
|
+
exports[`Translate command > extract openapi spec files with custom openapi schema provided 3`] = `
|
|
1045
|
+
"items:
|
|
1046
|
+
- name: '%%%0%%%'
|
|
1047
|
+
include:
|
|
1048
|
+
path: openapi
|
|
1049
|
+
includers:
|
|
1050
|
+
- name: openapi
|
|
1051
|
+
input: openapi-spec.yaml
|
|
1052
|
+
mode: link
|
|
1053
|
+
"
|
|
1054
|
+
`;
|
|
1055
|
+
|
|
1056
|
+
exports[`Translate command > extract openapi spec files with custom openapi schema provided 4`] = `
|
|
1057
|
+
"<?xml version="1.0" encoding="UTF-8"?>
|
|
1058
|
+
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2">
|
|
1059
|
+
<file original="file.ext" source-language="ru-RU" target-language="es-ES" datatype="markdown">
|
|
1060
|
+
<header>
|
|
1061
|
+
<skeleton>
|
|
1062
|
+
<external-file href="file.skl"></external-file>
|
|
1063
|
+
</skeleton>
|
|
1064
|
+
</header>
|
|
1065
|
+
<body>
|
|
1066
|
+
<trans-unit id="0">
|
|
1067
|
+
<source xml:space="preserve">openapi</source>
|
|
1068
|
+
</trans-unit>
|
|
1069
|
+
</body>
|
|
1070
|
+
</file>
|
|
1071
|
+
</xliff>"
|
|
1072
|
+
`;
|
|
1073
|
+
|
|
865
1074
|
exports[`Translate command > extract yaml scheme files > filelist 1`] = `
|
|
866
1075
|
"[
|
|
867
1076
|
"en/index-direct.yaml.skl",
|
package/e2e/translation.spec.ts
CHANGED
|
@@ -67,6 +67,24 @@ describe('Translate command', () => {
|
|
|
67
67
|
target: 'es-ES',
|
|
68
68
|
});
|
|
69
69
|
|
|
70
|
+
generateFilesYamlTestTemplate(
|
|
71
|
+
'extract openapi spec files with custom openapi schema provided',
|
|
72
|
+
'mocks/translation/custom-schema',
|
|
73
|
+
{
|
|
74
|
+
subcommand: 'extract',
|
|
75
|
+
source: 'ru-RU',
|
|
76
|
+
target: 'es-ES',
|
|
77
|
+
additionalArgs:
|
|
78
|
+
'--schema mocks/translation/custom-schema/custom-openapi-schema-30.yaml',
|
|
79
|
+
},
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
generateFilesYamlTestTemplate('compose openapi spec files', 'mocks/translation/compose', {
|
|
83
|
+
subcommand: 'compose',
|
|
84
|
+
source: 'ru-RU',
|
|
85
|
+
target: 'es-ES',
|
|
86
|
+
});
|
|
87
|
+
|
|
70
88
|
generateMapTestTemplate('do not filter files on extract', 'mocks/translation/dir-files', {
|
|
71
89
|
subcommand: 'extract',
|
|
72
90
|
source: 'ru-RU',
|
package/fixtures/cliAdapter.ts
CHANGED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
openapi: 3.0.1
|
|
2
|
+
info:
|
|
3
|
+
title: '%%%0%%%'
|
|
4
|
+
version: v0
|
|
5
|
+
servers:
|
|
6
|
+
- url: http://localhost:8080
|
|
7
|
+
description: '%%%1%%%'
|
|
8
|
+
paths:
|
|
9
|
+
/test:
|
|
10
|
+
get:
|
|
11
|
+
tags:
|
|
12
|
+
- '%%%2%%%'
|
|
13
|
+
summary: '%%%3%%%'
|
|
14
|
+
description: '%%%4%%%'
|
|
15
|
+
operationId: getWithPayloadResponse
|
|
16
|
+
responses:
|
|
17
|
+
'200':
|
|
18
|
+
description: '%%%5%%%'
|
|
19
|
+
content:
|
|
20
|
+
application/json:
|
|
21
|
+
schema:
|
|
22
|
+
$ref: '#/components/schemas/RecurceTop'
|
|
23
|
+
components:
|
|
24
|
+
schemas:
|
|
25
|
+
RecurceTop:
|
|
26
|
+
type: object
|
|
27
|
+
properties:
|
|
28
|
+
A:
|
|
29
|
+
type: string
|
|
30
|
+
description: |
|
|
31
|
+
%%%6%%%
|
|
32
|
+
- %%%7%%%
|
|
33
|
+
- %%%8%%%
|
|
34
|
+
- %%%9%%%
|
|
35
|
+
RecurceMiddle:
|
|
36
|
+
type: object
|
|
37
|
+
properties:
|
|
38
|
+
B:
|
|
39
|
+
type: array
|
|
40
|
+
items:
|
|
41
|
+
$ref: '#/components/schemas/RecurceTop'
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2">
|
|
3
|
+
<file original="file.ext" source-language="ru-RU" target-language="en-US" datatype="markdown">
|
|
4
|
+
<header>
|
|
5
|
+
<skeleton>
|
|
6
|
+
<external-file href="file.skl"></external-file>
|
|
7
|
+
</skeleton>
|
|
8
|
+
</header>
|
|
9
|
+
<body>
|
|
10
|
+
<trans-unit id="0">
|
|
11
|
+
<source xml:space="preserve">OpenAPI definition</source>
|
|
12
|
+
<target>Перевод 1</target>
|
|
13
|
+
</trans-unit>
|
|
14
|
+
<trans-unit id="1">
|
|
15
|
+
<source xml:space="preserve">Generated server url</source>
|
|
16
|
+
<target>Перевод 2</target>
|
|
17
|
+
</trans-unit>
|
|
18
|
+
<trans-unit id="2">
|
|
19
|
+
<source xml:space="preserve">test-controller</source>
|
|
20
|
+
<target>Перевод 3</target>
|
|
21
|
+
</trans-unit>
|
|
22
|
+
<trans-unit id="3">
|
|
23
|
+
<source xml:space="preserve">Simple get operation. тест новой верстки 3</source>
|
|
24
|
+
<target>Перевод 4</target>
|
|
25
|
+
</trans-unit>
|
|
26
|
+
<trans-unit id="4">
|
|
27
|
+
<source xml:space="preserve">Defines a simple get operation with no inputs and a complex</source>
|
|
28
|
+
<target>Перевод 5</target>
|
|
29
|
+
</trans-unit>
|
|
30
|
+
<trans-unit id="5">
|
|
31
|
+
<source xml:space="preserve">200!!!!</source>
|
|
32
|
+
<target>Перевод 6</target>
|
|
33
|
+
</trans-unit>
|
|
34
|
+
<trans-unit id="6">
|
|
35
|
+
<source xml:space="preserve">Статус загрузки:</source>
|
|
36
|
+
<target>Перевод 7</target>
|
|
37
|
+
</trans-unit>
|
|
38
|
+
<trans-unit id="7">
|
|
39
|
+
<source xml:space="preserve"><x ctype="code_open" equiv-text="`" id="x-1"/>UPLOADED<x ctype="code_close" equiv-text="`" id="x-2"/> — загрузка завершена.</source>
|
|
40
|
+
<target>Перевод 8</target>
|
|
41
|
+
</trans-unit>
|
|
42
|
+
<trans-unit id="8">
|
|
43
|
+
<source xml:space="preserve"><x ctype="code_open" equiv-text="`" id="x-3"/>IN_PROGRESS<x ctype="code_close" equiv-text="`" id="x-4"/> — загрузка находится в процессе обработки.</source>
|
|
44
|
+
<target>Перевод 9</target>
|
|
45
|
+
</trans-unit>
|
|
46
|
+
<trans-unit id="9">
|
|
47
|
+
<source xml:space="preserve"><x ctype="code_open" equiv-text="`" id="x-5"/>PROCESSED<x ctype="code_close" equiv-text="`" id="x-6"/> — загрузка успешно обработана.</source>
|
|
48
|
+
<target>Перевод 10</target>
|
|
49
|
+
</trans-unit>
|
|
50
|
+
</body>
|
|
51
|
+
</file>
|
|
52
|
+
</xliff>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2">
|
|
3
|
+
<file original="file.ext" source-language="ru-RU" target-language="en-US" datatype="markdown">
|
|
4
|
+
<header>
|
|
5
|
+
<skeleton>
|
|
6
|
+
<external-file href="file.skl"></external-file>
|
|
7
|
+
</skeleton>
|
|
8
|
+
</header>
|
|
9
|
+
<body>
|
|
10
|
+
<trans-unit id="0">
|
|
11
|
+
<source xml:space="preserve">openapi</source>
|
|
12
|
+
<target>Перевод 1</target>
|
|
13
|
+
</trans-unit>
|
|
14
|
+
</body>
|
|
15
|
+
</file>
|
|
16
|
+
</xliff>
|