dropbox-sign 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (139) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/README.md +26 -9
  4. data/VERSION +1 -0
  5. data/bin/release +39 -0
  6. data/bin/ruby +1 -0
  7. data/docs/BulkSendJobApi.md +5 -3
  8. data/docs/SignatureRequestApi.md +3 -3
  9. data/docs/SignatureRequestCreateEmbeddedRequest.md +1 -1
  10. data/docs/SignatureRequestSendRequest.md +1 -1
  11. data/docs/SubFormFieldsPerDocumentBase.md +1 -1
  12. data/docs/TeamResponse.md +1 -0
  13. data/docs/TemplateCreateEmbeddedDraftRequest.md +1 -1
  14. data/docs/TemplateResponse.md +2 -2
  15. data/docs/TemplateResponseDocument.md +3 -3
  16. data/docs/{TemplateResponseCustomField.md → TemplateResponseDocumentCustomFieldBase.md} +6 -8
  17. data/docs/TemplateResponseDocumentCustomFieldCheckbox.md +10 -0
  18. data/docs/TemplateResponseDocumentCustomFieldText.md +14 -0
  19. data/docs/TemplateResponseDocumentFieldGroup.md +1 -1
  20. data/docs/TemplateResponseDocumentFieldGroupRule.md +11 -0
  21. data/docs/{TemplateResponseDocumentFormField.md → TemplateResponseDocumentFormFieldBase.md} +5 -8
  22. data/docs/TemplateResponseDocumentFormFieldCheckbox.md +10 -0
  23. data/docs/TemplateResponseDocumentFormFieldDateSigned.md +10 -0
  24. data/docs/TemplateResponseDocumentFormFieldDropdown.md +10 -0
  25. data/docs/TemplateResponseDocumentFormFieldHyperlink.md +14 -0
  26. data/docs/TemplateResponseDocumentFormFieldInitials.md +10 -0
  27. data/docs/TemplateResponseDocumentFormFieldRadio.md +10 -0
  28. data/docs/TemplateResponseDocumentFormFieldSignature.md +10 -0
  29. data/docs/TemplateResponseDocumentFormFieldText.md +15 -0
  30. data/docs/{TemplateResponseDocumentStaticField.md → TemplateResponseDocumentStaticFieldBase.md} +6 -5
  31. data/docs/TemplateResponseDocumentStaticFieldCheckbox.md +10 -0
  32. data/docs/TemplateResponseDocumentStaticFieldDateSigned.md +10 -0
  33. data/docs/TemplateResponseDocumentStaticFieldDropdown.md +10 -0
  34. data/docs/TemplateResponseDocumentStaticFieldHyperlink.md +10 -0
  35. data/docs/TemplateResponseDocumentStaticFieldInitials.md +10 -0
  36. data/docs/TemplateResponseDocumentStaticFieldRadio.md +10 -0
  37. data/docs/TemplateResponseDocumentStaticFieldSignature.md +10 -0
  38. data/docs/TemplateResponseDocumentStaticFieldText.md +10 -0
  39. data/docs/TemplateResponseFieldAvgTextLength.md +1 -1
  40. data/docs/UnclaimedDraftApi.md +2 -2
  41. data/docs/UnclaimedDraftCreateEmbeddedRequest.md +1 -1
  42. data/docs/UnclaimedDraftCreateRequest.md +1 -1
  43. data/examples/SignatureRequestCreateEmbedded.rb +1 -1
  44. data/examples/SignatureRequestSend.rb +2 -2
  45. data/examples/UnclaimedDraftCreate.rb +2 -2
  46. data/lib/dropbox-sign/api/bulk_send_job_api.rb +6 -0
  47. data/lib/dropbox-sign/models/signature_request_create_embedded_request.rb +1 -1
  48. data/lib/dropbox-sign/models/signature_request_send_request.rb +1 -1
  49. data/lib/dropbox-sign/models/sub_form_fields_per_document_base.rb +1 -1
  50. data/lib/dropbox-sign/models/team_response.rb +17 -4
  51. data/lib/dropbox-sign/models/template_create_embedded_draft_request.rb +1 -1
  52. data/lib/dropbox-sign/models/template_response.rb +5 -5
  53. data/lib/dropbox-sign/models/template_response_document.rb +9 -9
  54. data/lib/dropbox-sign/models/{template_response_document_static_field.rb → template_response_document_custom_field_base.rb} +75 -43
  55. data/lib/dropbox-sign/models/template_response_document_custom_field_checkbox.rb +263 -0
  56. data/lib/dropbox-sign/models/template_response_document_custom_field_text.rb +306 -0
  57. data/lib/dropbox-sign/models/template_response_document_field_group.rb +2 -3
  58. data/lib/dropbox-sign/models/template_response_document_field_group_rule.rb +263 -0
  59. data/lib/dropbox-sign/models/{template_response_named_form_field.rb → template_response_document_form_field_base.rb} +82 -79
  60. data/lib/dropbox-sign/models/template_response_document_form_field_checkbox.rb +263 -0
  61. data/lib/dropbox-sign/models/template_response_document_form_field_date_signed.rb +263 -0
  62. data/lib/dropbox-sign/models/template_response_document_form_field_dropdown.rb +263 -0
  63. data/lib/dropbox-sign/models/template_response_document_form_field_hyperlink.rb +306 -0
  64. data/lib/dropbox-sign/models/template_response_document_form_field_initials.rb +263 -0
  65. data/lib/dropbox-sign/models/template_response_document_form_field_radio.rb +263 -0
  66. data/lib/dropbox-sign/models/template_response_document_form_field_signature.rb +263 -0
  67. data/lib/dropbox-sign/models/{template_response_document_form_field.rb → template_response_document_form_field_text.rb} +53 -132
  68. data/lib/dropbox-sign/models/{template_response_custom_field.rb → template_response_document_static_field_base.rb} +94 -112
  69. data/lib/dropbox-sign/models/template_response_document_static_field_checkbox.rb +263 -0
  70. data/lib/dropbox-sign/models/template_response_document_static_field_date_signed.rb +263 -0
  71. data/lib/dropbox-sign/models/template_response_document_static_field_dropdown.rb +263 -0
  72. data/lib/dropbox-sign/models/template_response_document_static_field_hyperlink.rb +263 -0
  73. data/lib/dropbox-sign/models/template_response_document_static_field_initials.rb +263 -0
  74. data/lib/dropbox-sign/models/template_response_document_static_field_radio.rb +263 -0
  75. data/lib/dropbox-sign/models/template_response_document_static_field_signature.rb +263 -0
  76. data/lib/dropbox-sign/models/template_response_document_static_field_text.rb +263 -0
  77. data/lib/dropbox-sign/models/template_response_field_avg_text_length.rb +1 -1
  78. data/lib/dropbox-sign/models/unclaimed_draft_create_embedded_request.rb +1 -1
  79. data/lib/dropbox-sign/models/unclaimed_draft_create_request.rb +1 -1
  80. data/lib/dropbox-sign/version.rb +1 -1
  81. data/lib/dropbox-sign.rb +22 -5
  82. data/openapi-config.yaml +4 -1
  83. data/openapi-sdk.yaml +598 -186
  84. data/templates/VERSION-root.mustache +1 -0
  85. data/test_fixtures/AccountCreateResponse.json +1 -0
  86. data/test_fixtures/ApiAppGetResponse.json +1 -0
  87. data/test_fixtures/ApiAppListResponse.json +1 -0
  88. data/test_fixtures/BulkSendJobGetResponse.json +8 -3
  89. data/test_fixtures/SignatureRequestGetResponse.json +65 -65
  90. data/test_fixtures/SignatureRequestListResponse.json +11 -4
  91. data/test_fixtures/TemplateGetResponse.json +1064 -41
  92. data/test_fixtures/TemplateListResponse.json +513 -44
  93. metadata +58 -64
  94. data/docs/TemplateResponseDocumentCustomField.md +0 -25
  95. data/docs/TemplateResponseNamedFormField.md +0 -23
  96. data/lib/dropbox-sign/models/template_response_document_custom_field.rb +0 -454
  97. data/vendor/autoload.php +0 -7
  98. data/vendor/bin/yaml-lint +0 -117
  99. data/vendor/composer/ClassLoader.php +0 -572
  100. data/vendor/composer/InstalledVersions.php +0 -350
  101. data/vendor/composer/LICENSE +0 -21
  102. data/vendor/composer/autoload_classmap.php +0 -10
  103. data/vendor/composer/autoload_files.php +0 -11
  104. data/vendor/composer/autoload_namespaces.php +0 -9
  105. data/vendor/composer/autoload_psr4.php +0 -11
  106. data/vendor/composer/autoload_real.php +0 -80
  107. data/vendor/composer/autoload_static.php +0 -46
  108. data/vendor/composer/installed.json +0 -239
  109. data/vendor/composer/installed.php +0 -50
  110. data/vendor/composer/platform_check.php +0 -26
  111. data/vendor/symfony/deprecation-contracts/.gitignore +0 -3
  112. data/vendor/symfony/deprecation-contracts/CHANGELOG.md +0 -5
  113. data/vendor/symfony/deprecation-contracts/LICENSE +0 -19
  114. data/vendor/symfony/deprecation-contracts/README.md +0 -26
  115. data/vendor/symfony/deprecation-contracts/composer.json +0 -35
  116. data/vendor/symfony/deprecation-contracts/function.php +0 -27
  117. data/vendor/symfony/polyfill-ctype/Ctype.php +0 -232
  118. data/vendor/symfony/polyfill-ctype/LICENSE +0 -19
  119. data/vendor/symfony/polyfill-ctype/README.md +0 -12
  120. data/vendor/symfony/polyfill-ctype/bootstrap.php +0 -50
  121. data/vendor/symfony/polyfill-ctype/bootstrap80.php +0 -46
  122. data/vendor/symfony/polyfill-ctype/composer.json +0 -41
  123. data/vendor/symfony/yaml/CHANGELOG.md +0 -237
  124. data/vendor/symfony/yaml/Command/LintCommand.php +0 -289
  125. data/vendor/symfony/yaml/Dumper.php +0 -140
  126. data/vendor/symfony/yaml/Escaper.php +0 -95
  127. data/vendor/symfony/yaml/Exception/DumpException.php +0 -21
  128. data/vendor/symfony/yaml/Exception/ExceptionInterface.php +0 -21
  129. data/vendor/symfony/yaml/Exception/ParseException.php +0 -132
  130. data/vendor/symfony/yaml/Exception/RuntimeException.php +0 -21
  131. data/vendor/symfony/yaml/Inline.php +0 -812
  132. data/vendor/symfony/yaml/LICENSE +0 -19
  133. data/vendor/symfony/yaml/Parser.php +0 -1305
  134. data/vendor/symfony/yaml/README.md +0 -13
  135. data/vendor/symfony/yaml/Resources/bin/yaml-lint +0 -45
  136. data/vendor/symfony/yaml/Tag/TaggedValue.php +0 -38
  137. data/vendor/symfony/yaml/Unescaper.php +0 -132
  138. data/vendor/symfony/yaml/Yaml.php +0 -100
  139. data/vendor/symfony/yaml/composer.json +0 -42
@@ -1,19 +0,0 @@
1
- Copyright (c) 2018-2019 Fabien Potencier
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining a copy
4
- of this software and associated documentation files (the "Software"), to deal
5
- in the Software without restriction, including without limitation the rights
6
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
- copies of the Software, and to permit persons to whom the Software is furnished
8
- to do so, subject to the following conditions:
9
-
10
- The above copyright notice and this permission notice shall be included in all
11
- copies or substantial portions of the Software.
12
-
13
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
- THE SOFTWARE.
@@ -1,12 +0,0 @@
1
- Symfony Polyfill / Ctype
2
- ========================
3
-
4
- This component provides `ctype_*` functions to users who run php versions without the ctype extension.
5
-
6
- More information can be found in the
7
- [main Polyfill README](https://github.com/symfony/polyfill/blob/master/README.md).
8
-
9
- License
10
- =======
11
-
12
- This library is released under the [MIT license](LICENSE).
@@ -1,50 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Symfony package.
5
- *
6
- * (c) Fabien Potencier <fabien@symfony.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- use Symfony\Polyfill\Ctype as p;
13
-
14
- if (\PHP_VERSION_ID >= 80000) {
15
- return require __DIR__.'/bootstrap80.php';
16
- }
17
-
18
- if (!function_exists('ctype_alnum')) {
19
- function ctype_alnum($text) { return p\Ctype::ctype_alnum($text); }
20
- }
21
- if (!function_exists('ctype_alpha')) {
22
- function ctype_alpha($text) { return p\Ctype::ctype_alpha($text); }
23
- }
24
- if (!function_exists('ctype_cntrl')) {
25
- function ctype_cntrl($text) { return p\Ctype::ctype_cntrl($text); }
26
- }
27
- if (!function_exists('ctype_digit')) {
28
- function ctype_digit($text) { return p\Ctype::ctype_digit($text); }
29
- }
30
- if (!function_exists('ctype_graph')) {
31
- function ctype_graph($text) { return p\Ctype::ctype_graph($text); }
32
- }
33
- if (!function_exists('ctype_lower')) {
34
- function ctype_lower($text) { return p\Ctype::ctype_lower($text); }
35
- }
36
- if (!function_exists('ctype_print')) {
37
- function ctype_print($text) { return p\Ctype::ctype_print($text); }
38
- }
39
- if (!function_exists('ctype_punct')) {
40
- function ctype_punct($text) { return p\Ctype::ctype_punct($text); }
41
- }
42
- if (!function_exists('ctype_space')) {
43
- function ctype_space($text) { return p\Ctype::ctype_space($text); }
44
- }
45
- if (!function_exists('ctype_upper')) {
46
- function ctype_upper($text) { return p\Ctype::ctype_upper($text); }
47
- }
48
- if (!function_exists('ctype_xdigit')) {
49
- function ctype_xdigit($text) { return p\Ctype::ctype_xdigit($text); }
50
- }
@@ -1,46 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Symfony package.
5
- *
6
- * (c) Fabien Potencier <fabien@symfony.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- use Symfony\Polyfill\Ctype as p;
13
-
14
- if (!function_exists('ctype_alnum')) {
15
- function ctype_alnum(mixed $text): bool { return p\Ctype::ctype_alnum($text); }
16
- }
17
- if (!function_exists('ctype_alpha')) {
18
- function ctype_alpha(mixed $text): bool { return p\Ctype::ctype_alpha($text); }
19
- }
20
- if (!function_exists('ctype_cntrl')) {
21
- function ctype_cntrl(mixed $text): bool { return p\Ctype::ctype_cntrl($text); }
22
- }
23
- if (!function_exists('ctype_digit')) {
24
- function ctype_digit(mixed $text): bool { return p\Ctype::ctype_digit($text); }
25
- }
26
- if (!function_exists('ctype_graph')) {
27
- function ctype_graph(mixed $text): bool { return p\Ctype::ctype_graph($text); }
28
- }
29
- if (!function_exists('ctype_lower')) {
30
- function ctype_lower(mixed $text): bool { return p\Ctype::ctype_lower($text); }
31
- }
32
- if (!function_exists('ctype_print')) {
33
- function ctype_print(mixed $text): bool { return p\Ctype::ctype_print($text); }
34
- }
35
- if (!function_exists('ctype_punct')) {
36
- function ctype_punct(mixed $text): bool { return p\Ctype::ctype_punct($text); }
37
- }
38
- if (!function_exists('ctype_space')) {
39
- function ctype_space(mixed $text): bool { return p\Ctype::ctype_space($text); }
40
- }
41
- if (!function_exists('ctype_upper')) {
42
- function ctype_upper(mixed $text): bool { return p\Ctype::ctype_upper($text); }
43
- }
44
- if (!function_exists('ctype_xdigit')) {
45
- function ctype_xdigit(mixed $text): bool { return p\Ctype::ctype_xdigit($text); }
46
- }
@@ -1,41 +0,0 @@
1
- {
2
- "name": "symfony/polyfill-ctype",
3
- "type": "library",
4
- "description": "Symfony polyfill for ctype functions",
5
- "keywords": ["polyfill", "compatibility", "portable", "ctype"],
6
- "homepage": "https://symfony.com",
7
- "license": "MIT",
8
- "authors": [
9
- {
10
- "name": "Gert de Pagter",
11
- "email": "BackEndTea@gmail.com"
12
- },
13
- {
14
- "name": "Symfony Community",
15
- "homepage": "https://symfony.com/contributors"
16
- }
17
- ],
18
- "require": {
19
- "php": ">=7.1"
20
- },
21
- "provide": {
22
- "ext-ctype": "*"
23
- },
24
- "autoload": {
25
- "psr-4": { "Symfony\\Polyfill\\Ctype\\": "" },
26
- "files": [ "bootstrap.php" ]
27
- },
28
- "suggest": {
29
- "ext-ctype": "For best performance"
30
- },
31
- "minimum-stability": "dev",
32
- "extra": {
33
- "branch-alias": {
34
- "dev-main": "1.23-dev"
35
- },
36
- "thanks": {
37
- "name": "symfony/polyfill",
38
- "url": "https://github.com/symfony/polyfill"
39
- }
40
- }
41
- }
@@ -1,237 +0,0 @@
1
- CHANGELOG
2
- =========
3
-
4
- 5.4
5
- ---
6
-
7
- * Add new `lint:yaml dirname --exclude=/dirname/foo.yaml --exclude=/dirname/bar.yaml`
8
- option to exclude one or more specific files from multiple file list
9
- * Allow negatable for the parse tags option with `--no-parse-tags`
10
-
11
- 5.3
12
- ---
13
-
14
- * Added `github` format support & autodetection to render errors as annotations
15
- when running the YAML linter command in a Github Action environment.
16
-
17
- 5.1.0
18
- -----
19
-
20
- * Added support for parsing numbers prefixed with `0o` as octal numbers.
21
- * Deprecated support for parsing numbers starting with `0` as octal numbers. They will be parsed as strings as of Symfony 6.0. Prefix numbers with `0o`
22
- so that they are parsed as octal numbers.
23
-
24
- Before:
25
-
26
- ```yaml
27
- Yaml::parse('072');
28
- ```
29
-
30
- After:
31
-
32
- ```yaml
33
- Yaml::parse('0o72');
34
- ```
35
-
36
- * Added `yaml-lint` binary.
37
- * Deprecated using the `!php/object` and `!php/const` tags without a value.
38
-
39
- 5.0.0
40
- -----
41
-
42
- * Removed support for mappings inside multi-line strings.
43
- * removed support for implicit STDIN usage in the `lint:yaml` command, use `lint:yaml -` (append a dash) instead to make it explicit.
44
-
45
- 4.4.0
46
- -----
47
-
48
- * Added support for parsing the inline notation spanning multiple lines.
49
- * Added support to dump `null` as `~` by using the `Yaml::DUMP_NULL_AS_TILDE` flag.
50
- * deprecated accepting STDIN implicitly when using the `lint:yaml` command, use `lint:yaml -` (append a dash) instead to make it explicit.
51
-
52
- 4.3.0
53
- -----
54
-
55
- * Using a mapping inside a multi-line string is deprecated and will throw a `ParseException` in 5.0.
56
-
57
- 4.2.0
58
- -----
59
-
60
- * added support for multiple files or directories in `LintCommand`
61
-
62
- 4.0.0
63
- -----
64
-
65
- * The behavior of the non-specific tag `!` is changed and now forces
66
- non-evaluating your values.
67
- * complex mappings will throw a `ParseException`
68
- * support for the comma as a group separator for floats has been dropped, use
69
- the underscore instead
70
- * support for the `!!php/object` tag has been dropped, use the `!php/object`
71
- tag instead
72
- * duplicate mapping keys throw a `ParseException`
73
- * non-string mapping keys throw a `ParseException`, use the `Yaml::PARSE_KEYS_AS_STRINGS`
74
- flag to cast them to strings
75
- * `%` at the beginning of an unquoted string throw a `ParseException`
76
- * mappings with a colon (`:`) that is not followed by a whitespace throw a
77
- `ParseException`
78
- * the `Dumper::setIndentation()` method has been removed
79
- * being able to pass boolean options to the `Yaml::parse()`, `Yaml::dump()`,
80
- `Parser::parse()`, and `Dumper::dump()` methods to configure the behavior of
81
- the parser and dumper is no longer supported, pass bitmask flags instead
82
- * the constructor arguments of the `Parser` class have been removed
83
- * the `Inline` class is internal and no longer part of the BC promise
84
- * removed support for the `!str` tag, use the `!!str` tag instead
85
- * added support for tagged scalars.
86
-
87
- ```yml
88
- Yaml::parse('!foo bar', Yaml::PARSE_CUSTOM_TAGS);
89
- // returns TaggedValue('foo', 'bar');
90
- ```
91
-
92
- 3.4.0
93
- -----
94
-
95
- * added support for parsing YAML files using the `Yaml::parseFile()` or `Parser::parseFile()` method
96
-
97
- * the `Dumper`, `Parser`, and `Yaml` classes are marked as final
98
-
99
- * Deprecated the `!php/object:` tag which will be replaced by the
100
- `!php/object` tag (without the colon) in 4.0.
101
-
102
- * Deprecated the `!php/const:` tag which will be replaced by the
103
- `!php/const` tag (without the colon) in 4.0.
104
-
105
- * Support for the `!str` tag is deprecated, use the `!!str` tag instead.
106
-
107
- * Deprecated using the non-specific tag `!` as its behavior will change in 4.0.
108
- It will force non-evaluating your values in 4.0. Use plain integers or `!!float` instead.
109
-
110
- 3.3.0
111
- -----
112
-
113
- * Starting an unquoted string with a question mark followed by a space is
114
- deprecated and will throw a `ParseException` in Symfony 4.0.
115
-
116
- * Deprecated support for implicitly parsing non-string mapping keys as strings.
117
- Mapping keys that are no strings will lead to a `ParseException` in Symfony
118
- 4.0. Use quotes to opt-in for keys to be parsed as strings.
119
-
120
- Before:
121
-
122
- ```php
123
- $yaml = <<<YAML
124
- null: null key
125
- true: boolean true
126
- 2.0: float key
127
- YAML;
128
-
129
- Yaml::parse($yaml);
130
- ```
131
-
132
- After:
133
-
134
- ```php
135
-
136
- $yaml = <<<YAML
137
- "null": null key
138
- "true": boolean true
139
- "2.0": float key
140
- YAML;
141
-
142
- Yaml::parse($yaml);
143
- ```
144
-
145
- * Omitted mapping values will be parsed as `null`.
146
-
147
- * Omitting the key of a mapping is deprecated and will throw a `ParseException` in Symfony 4.0.
148
-
149
- * Added support for dumping empty PHP arrays as YAML sequences:
150
-
151
- ```php
152
- Yaml::dump([], 0, 0, Yaml::DUMP_EMPTY_ARRAY_AS_SEQUENCE);
153
- ```
154
-
155
- 3.2.0
156
- -----
157
-
158
- * Mappings with a colon (`:`) that is not followed by a whitespace are deprecated
159
- when the mapping key is not quoted and will lead to a `ParseException` in
160
- Symfony 4.0 (e.g. `foo:bar` must be `foo: bar`).
161
-
162
- * Added support for parsing PHP constants:
163
-
164
- ```php
165
- Yaml::parse('!php/const:PHP_INT_MAX', Yaml::PARSE_CONSTANT);
166
- ```
167
-
168
- * Support for silently ignoring duplicate mapping keys in YAML has been
169
- deprecated and will lead to a `ParseException` in Symfony 4.0.
170
-
171
- 3.1.0
172
- -----
173
-
174
- * Added support to dump `stdClass` and `ArrayAccess` objects as YAML mappings
175
- through the `Yaml::DUMP_OBJECT_AS_MAP` flag.
176
-
177
- * Strings that are not UTF-8 encoded will be dumped as base64 encoded binary
178
- data.
179
-
180
- * Added support for dumping multi line strings as literal blocks.
181
-
182
- * Added support for parsing base64 encoded binary data when they are tagged
183
- with the `!!binary` tag.
184
-
185
- * Added support for parsing timestamps as `\DateTime` objects:
186
-
187
- ```php
188
- Yaml::parse('2001-12-15 21:59:43.10 -5', Yaml::PARSE_DATETIME);
189
- ```
190
-
191
- * `\DateTime` and `\DateTimeImmutable` objects are dumped as YAML timestamps.
192
-
193
- * Deprecated usage of `%` at the beginning of an unquoted string.
194
-
195
- * Added support for customizing the YAML parser behavior through an optional bit field:
196
-
197
- ```php
198
- Yaml::parse('{ "foo": "bar", "fiz": "cat" }', Yaml::PARSE_EXCEPTION_ON_INVALID_TYPE | Yaml::PARSE_OBJECT | Yaml::PARSE_OBJECT_FOR_MAP);
199
- ```
200
-
201
- * Added support for customizing the dumped YAML string through an optional bit field:
202
-
203
- ```php
204
- Yaml::dump(['foo' => new A(), 'bar' => 1], 0, 0, Yaml::DUMP_EXCEPTION_ON_INVALID_TYPE | Yaml::DUMP_OBJECT);
205
- ```
206
-
207
- 3.0.0
208
- -----
209
-
210
- * Yaml::parse() now throws an exception when a blackslash is not escaped
211
- in double-quoted strings
212
-
213
- 2.8.0
214
- -----
215
-
216
- * Deprecated usage of a colon in an unquoted mapping value
217
- * Deprecated usage of @, \`, | and > at the beginning of an unquoted string
218
- * When surrounding strings with double-quotes, you must now escape `\` characters. Not
219
- escaping those characters (when surrounded by double-quotes) is deprecated.
220
-
221
- Before:
222
-
223
- ```yml
224
- class: "Foo\Var"
225
- ```
226
-
227
- After:
228
-
229
- ```yml
230
- class: "Foo\\Var"
231
- ```
232
-
233
- 2.1.0
234
- -----
235
-
236
- * Yaml::parse() does not evaluate loaded files as PHP files by default
237
- anymore (call Yaml::enablePhpParsing() to get back the old behavior)
@@ -1,289 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Symfony package.
5
- *
6
- * (c) Fabien Potencier <fabien@symfony.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Symfony\Component\Yaml\Command;
13
-
14
- use Symfony\Component\Console\CI\GithubActionReporter;
15
- use Symfony\Component\Console\Command\Command;
16
- use Symfony\Component\Console\Completion\CompletionInput;
17
- use Symfony\Component\Console\Completion\CompletionSuggestions;
18
- use Symfony\Component\Console\Exception\InvalidArgumentException;
19
- use Symfony\Component\Console\Exception\RuntimeException;
20
- use Symfony\Component\Console\Input\InputArgument;
21
- use Symfony\Component\Console\Input\InputInterface;
22
- use Symfony\Component\Console\Input\InputOption;
23
- use Symfony\Component\Console\Output\OutputInterface;
24
- use Symfony\Component\Console\Style\SymfonyStyle;
25
- use Symfony\Component\Yaml\Exception\ParseException;
26
- use Symfony\Component\Yaml\Parser;
27
- use Symfony\Component\Yaml\Yaml;
28
-
29
- /**
30
- * Validates YAML files syntax and outputs encountered errors.
31
- *
32
- * @author Grégoire Pineau <lyrixx@lyrixx.info>
33
- * @author Robin Chalas <robin.chalas@gmail.com>
34
- */
35
- class LintCommand extends Command
36
- {
37
- protected static $defaultName = 'lint:yaml';
38
- protected static $defaultDescription = 'Lint a YAML file and outputs encountered errors';
39
-
40
- private $parser;
41
- private $format;
42
- private $displayCorrectFiles;
43
- private $directoryIteratorProvider;
44
- private $isReadableProvider;
45
-
46
- public function __construct(string $name = null, callable $directoryIteratorProvider = null, callable $isReadableProvider = null)
47
- {
48
- parent::__construct($name);
49
-
50
- $this->directoryIteratorProvider = $directoryIteratorProvider;
51
- $this->isReadableProvider = $isReadableProvider;
52
- }
53
-
54
- /**
55
- * {@inheritdoc}
56
- */
57
- protected function configure()
58
- {
59
- $this
60
- ->setDescription(self::$defaultDescription)
61
- ->addArgument('filename', InputArgument::IS_ARRAY, 'A file, a directory or "-" for reading from STDIN')
62
- ->addOption('format', null, InputOption::VALUE_REQUIRED, 'The output format')
63
- ->addOption('exclude', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Path(s) to exclude')
64
- ->addOption('parse-tags', null, InputOption::VALUE_NEGATABLE, 'Parse custom tags', null)
65
- ->setHelp(<<<EOF
66
- The <info>%command.name%</info> command lints a YAML file and outputs to STDOUT
67
- the first encountered syntax error.
68
-
69
- You can validates YAML contents passed from STDIN:
70
-
71
- <info>cat filename | php %command.full_name% -</info>
72
-
73
- You can also validate the syntax of a file:
74
-
75
- <info>php %command.full_name% filename</info>
76
-
77
- Or of a whole directory:
78
-
79
- <info>php %command.full_name% dirname</info>
80
- <info>php %command.full_name% dirname --format=json</info>
81
-
82
- You can also exclude one or more specific files:
83
-
84
- <info>php %command.full_name% dirname --exclude="dirname/foo.yaml" --exclude="dirname/bar.yaml"</info>
85
-
86
- EOF
87
- )
88
- ;
89
- }
90
-
91
- protected function execute(InputInterface $input, OutputInterface $output)
92
- {
93
- $io = new SymfonyStyle($input, $output);
94
- $filenames = (array) $input->getArgument('filename');
95
- $excludes = $input->getOption('exclude');
96
- $this->format = $input->getOption('format');
97
- $flags = $input->getOption('parse-tags');
98
-
99
- if ('github' === $this->format && !class_exists(GithubActionReporter::class)) {
100
- throw new \InvalidArgumentException('The "github" format is only available since "symfony/console" >= 5.3.');
101
- }
102
-
103
- if (null === $this->format) {
104
- // Autodetect format according to CI environment
105
- $this->format = class_exists(GithubActionReporter::class) && GithubActionReporter::isGithubActionEnvironment() ? 'github' : 'txt';
106
- }
107
-
108
- $flags = $flags ? Yaml::PARSE_CUSTOM_TAGS : 0;
109
-
110
- $this->displayCorrectFiles = $output->isVerbose();
111
-
112
- if (['-'] === $filenames) {
113
- return $this->display($io, [$this->validate(file_get_contents('php://stdin'), $flags)]);
114
- }
115
-
116
- if (!$filenames) {
117
- throw new RuntimeException('Please provide a filename or pipe file content to STDIN.');
118
- }
119
-
120
- $filesInfo = [];
121
- foreach ($filenames as $filename) {
122
- if (!$this->isReadable($filename)) {
123
- throw new RuntimeException(sprintf('File or directory "%s" is not readable.', $filename));
124
- }
125
-
126
- foreach ($this->getFiles($filename) as $file) {
127
- if (!\in_array($file->getPathname(), $excludes, true)) {
128
- $filesInfo[] = $this->validate(file_get_contents($file), $flags, $file);
129
- }
130
- }
131
- }
132
-
133
- return $this->display($io, $filesInfo);
134
- }
135
-
136
- private function validate(string $content, int $flags, string $file = null)
137
- {
138
- $prevErrorHandler = set_error_handler(function ($level, $message, $file, $line) use (&$prevErrorHandler) {
139
- if (\E_USER_DEPRECATED === $level) {
140
- throw new ParseException($message, $this->getParser()->getRealCurrentLineNb() + 1);
141
- }
142
-
143
- return $prevErrorHandler ? $prevErrorHandler($level, $message, $file, $line) : false;
144
- });
145
-
146
- try {
147
- $this->getParser()->parse($content, Yaml::PARSE_CONSTANT | $flags);
148
- } catch (ParseException $e) {
149
- return ['file' => $file, 'line' => $e->getParsedLine(), 'valid' => false, 'message' => $e->getMessage()];
150
- } finally {
151
- restore_error_handler();
152
- }
153
-
154
- return ['file' => $file, 'valid' => true];
155
- }
156
-
157
- private function display(SymfonyStyle $io, array $files): int
158
- {
159
- switch ($this->format) {
160
- case 'txt':
161
- return $this->displayTxt($io, $files);
162
- case 'json':
163
- return $this->displayJson($io, $files);
164
- case 'github':
165
- return $this->displayTxt($io, $files, true);
166
- default:
167
- throw new InvalidArgumentException(sprintf('The format "%s" is not supported.', $this->format));
168
- }
169
- }
170
-
171
- private function displayTxt(SymfonyStyle $io, array $filesInfo, bool $errorAsGithubAnnotations = false): int
172
- {
173
- $countFiles = \count($filesInfo);
174
- $erroredFiles = 0;
175
- $suggestTagOption = false;
176
-
177
- if ($errorAsGithubAnnotations) {
178
- $githubReporter = new GithubActionReporter($io);
179
- }
180
-
181
- foreach ($filesInfo as $info) {
182
- if ($info['valid'] && $this->displayCorrectFiles) {
183
- $io->comment('<info>OK</info>'.($info['file'] ? sprintf(' in %s', $info['file']) : ''));
184
- } elseif (!$info['valid']) {
185
- ++$erroredFiles;
186
- $io->text('<error> ERROR </error>'.($info['file'] ? sprintf(' in %s', $info['file']) : ''));
187
- $io->text(sprintf('<error> >> %s</error>', $info['message']));
188
-
189
- if (false !== strpos($info['message'], 'PARSE_CUSTOM_TAGS')) {
190
- $suggestTagOption = true;
191
- }
192
-
193
- if ($errorAsGithubAnnotations) {
194
- $githubReporter->error($info['message'], $info['file'] ?? 'php://stdin', $info['line']);
195
- }
196
- }
197
- }
198
-
199
- if (0 === $erroredFiles) {
200
- $io->success(sprintf('All %d YAML files contain valid syntax.', $countFiles));
201
- } else {
202
- $io->warning(sprintf('%d YAML files have valid syntax and %d contain errors.%s', $countFiles - $erroredFiles, $erroredFiles, $suggestTagOption ? ' Use the --parse-tags option if you want parse custom tags.' : ''));
203
- }
204
-
205
- return min($erroredFiles, 1);
206
- }
207
-
208
- private function displayJson(SymfonyStyle $io, array $filesInfo): int
209
- {
210
- $errors = 0;
211
-
212
- array_walk($filesInfo, function (&$v) use (&$errors) {
213
- $v['file'] = (string) $v['file'];
214
- if (!$v['valid']) {
215
- ++$errors;
216
- }
217
-
218
- if (isset($v['message']) && false !== strpos($v['message'], 'PARSE_CUSTOM_TAGS')) {
219
- $v['message'] .= ' Use the --parse-tags option if you want parse custom tags.';
220
- }
221
- });
222
-
223
- $io->writeln(json_encode($filesInfo, \JSON_PRETTY_PRINT | \JSON_UNESCAPED_SLASHES));
224
-
225
- return min($errors, 1);
226
- }
227
-
228
- private function getFiles(string $fileOrDirectory): iterable
229
- {
230
- if (is_file($fileOrDirectory)) {
231
- yield new \SplFileInfo($fileOrDirectory);
232
-
233
- return;
234
- }
235
-
236
- foreach ($this->getDirectoryIterator($fileOrDirectory) as $file) {
237
- if (!\in_array($file->getExtension(), ['yml', 'yaml'])) {
238
- continue;
239
- }
240
-
241
- yield $file;
242
- }
243
- }
244
-
245
- private function getParser(): Parser
246
- {
247
- if (!$this->parser) {
248
- $this->parser = new Parser();
249
- }
250
-
251
- return $this->parser;
252
- }
253
-
254
- private function getDirectoryIterator(string $directory): iterable
255
- {
256
- $default = function ($directory) {
257
- return new \RecursiveIteratorIterator(
258
- new \RecursiveDirectoryIterator($directory, \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::FOLLOW_SYMLINKS),
259
- \RecursiveIteratorIterator::LEAVES_ONLY
260
- );
261
- };
262
-
263
- if (null !== $this->directoryIteratorProvider) {
264
- return ($this->directoryIteratorProvider)($directory, $default);
265
- }
266
-
267
- return $default($directory);
268
- }
269
-
270
- private function isReadable(string $fileOrDirectory): bool
271
- {
272
- $default = function ($fileOrDirectory) {
273
- return is_readable($fileOrDirectory);
274
- };
275
-
276
- if (null !== $this->isReadableProvider) {
277
- return ($this->isReadableProvider)($fileOrDirectory, $default);
278
- }
279
-
280
- return $default($fileOrDirectory);
281
- }
282
-
283
- public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void
284
- {
285
- if ($input->mustSuggestOptionValuesFor('format')) {
286
- $suggestions->suggestValues(['txt', 'json', 'github']);
287
- }
288
- }
289
- }