Skip to main content

mago_composer/
schema.rs

1use foldhash::HashMap;
2use serde::Deserialize;
3use serde::Serialize;
4use serde_json::Value;
5
6#[derive(Deserialize, Serialize, Clone, Debug)]
7pub struct ComposerPackage {
8    /// Indicates whether this package has been abandoned, it can be boolean or a package name/URL pointing to a recommended alternative.
9    #[serde(default, skip_serializing_if = "Option::is_none")]
10    pub abandoned: Option<ComposerPackageAbandoned>,
11
12    /// Options for creating package archives for distribution.
13    #[serde(default, skip_serializing_if = "Option::is_none")]
14    pub archive: Option<ComposerPackageArchive>,
15
16    #[serde(default, skip_serializing_if = "Option::is_none")]
17    pub authors: Option<Authors>,
18
19    #[serde(default, skip_serializing_if = "Option::is_none")]
20    pub autoload: Option<Autoload>,
21
22    #[serde(rename = "autoload-dev", default, skip_serializing_if = "Option::is_none")]
23    pub autoload_dev: Option<ComposerPackageAutoloadDev>,
24
25    /// A set of files, or a single file, that should be treated as binaries and symlinked into bin-dir (from config)
26    #[serde(default, skip_serializing_if = "Option::is_none")]
27    pub bin: Option<ComposerPackageBin>,
28
29    /// A key to store comments in"]
30    #[serde(rename = "_comment", default, skip_serializing_if = "Option::is_none")]
31    pub comment: Option<ComposerPackageComment>,
32
33    #[serde(default, skip_serializing_if = "Option::is_none")]
34    pub config: Option<ComposerPackageConfig>,
35
36    /// This is an object of package name (keys) and version constraints (values) that conflict with this package
37    #[serde(default, skip_serializing_if = "HashMap::is_empty")]
38    pub conflict: HashMap<String, String>,
39
40    /// Internal use only, do not specify this in composer.json. Indicates whether this version is the default branch of the linked VCS repository. Defaults to false
41    #[serde(rename = "default-branch", default, skip_serializing_if = "Option::is_none")]
42    pub default_branch: Option<bool>,
43
44    /// Short package description
45    #[serde(default, skip_serializing_if = "Option::is_none")]
46    pub description: Option<String>,
47
48    #[serde(default, skip_serializing_if = "Option::is_none")]
49    pub dist: Option<Dist>,
50
51    /// Arbitrary extra data that can be used by plugins, for example, package of type composer-plugin may have a 'class' key defining an installer class name
52    #[serde(default, skip_serializing_if = "Option::is_none")]
53    pub extra: Option<ComposerPackageExtra>,
54
55    /// A list of options to fund the development and maintenance of the package
56    #[serde(default, skip_serializing_if = "Vec::is_empty")]
57    pub funding: Vec<ComposerPackageFundingItem>,
58
59    /// Homepage URL for the project
60    #[serde(default, skip_serializing_if = "Option::is_none")]
61    pub homepage: Option<String>,
62
63    /// A list of directories which should get added to PHP's include path.
64    #[serde(rename = "include-path", default, skip_serializing_if = "Vec::is_empty")]
65    #[deprecated(
66        note = "This is only present to support legacy projects, and all new code should preferably use autoloading"
67    )]
68    pub include_path: Vec<String>,
69
70    #[serde(default, skip_serializing_if = "Vec::is_empty")]
71    pub keywords: Vec<String>,
72
73    /// License name. Or an array of license names
74    #[serde(default, skip_serializing_if = "Option::is_none")]
75    pub license: Option<ComposerPackageLicense>,
76
77    /// The minimum stability the packages must have to be install-able. Possible values are: dev, alpha, beta, RC, stable
78    #[serde(rename = "minimum-stability", default, skip_serializing_if = "Option::is_none")]
79    pub minimum_stability: Option<ComposerPackageMinimumStability>,
80
81    /// Package name, including 'vendor-name/' prefix
82    #[serde(default, skip_serializing_if = "Option::is_none")]
83    pub name: Option<ComposerPackageName>,
84
85    /// A set of string or regex patterns for non-numeric branch names that will not be handled as feature branches
86    #[serde(rename = "non-feature-branches", default, skip_serializing_if = "Vec::is_empty")]
87    pub non_feature_branches: Vec<String>,
88
89    #[serde(rename = "php-ext", default, skip_serializing_if = "Option::is_none")]
90    pub php_ext: Option<ComposerPackagePhpExt>,
91
92    /// If set to true, stable packages will be preferred to dev packages when possible, even if the minimum-stability allows unstable packages
93    #[serde(rename = "prefer-stable", default, skip_serializing_if = "Option::is_none")]
94    pub prefer_stable: Option<bool>,
95
96    /// This is an object of package name (keys) and version constraints (values) that this package provides in addition to this package's name
97    #[serde(default, skip_serializing_if = "HashMap::is_empty")]
98    pub provide: HashMap<String, String>,
99
100    /// Relative path to the readme document
101    #[serde(default, skip_serializing_if = "Option::is_none")]
102    pub readme: Option<String>,
103
104    /// This is an object of package name (keys) and version constraints (values) that can be replaced by this package
105    #[serde(default, skip_serializing_if = "HashMap::is_empty")]
106    pub replace: HashMap<String, String>,
107
108    /// A set of additional repositories where packages can be found
109    #[serde(default, skip_serializing_if = "Option::is_none")]
110    pub repositories: Option<ComposerPackageRepositories>,
111
112    /// This is an object of package name (keys) and version constraints (values) that are required to run this package
113    #[serde(default, skip_serializing_if = "HashMap::is_empty")]
114    pub require: HashMap<String, String>,
115
116    /// This is an object of package name (keys) and version constraints (values) that this package requires for developing it (testing tools and such)
117    #[serde(rename = "require-dev", default, skip_serializing_if = "HashMap::is_empty")]
118    pub require_dev: HashMap<String, String>,
119
120    /// Script listeners that will be executed before/after some events
121    #[serde(default, skip_serializing_if = "Option::is_none")]
122    pub scripts: Option<ComposerPackageScripts>,
123
124    /// Aliases for custom commands
125    #[serde(rename = "scripts-aliases", default, skip_serializing_if = "HashMap::is_empty")]
126    pub scripts_aliases: HashMap<String, Vec<String>>,
127
128    /// Descriptions for custom commands, shown in console help
129    #[serde(rename = "scripts-descriptions", default, skip_serializing_if = "HashMap::is_empty")]
130    pub scripts_descriptions: HashMap<String, String>,
131
132    #[serde(default, skip_serializing_if = "Option::is_none")]
133    pub source: Option<Source>,
134
135    /// This is an object of package name (keys) and descriptions (values) that this package suggests work well with it (this will be suggested to the user during installation)
136    #[serde(default, skip_serializing_if = "HashMap::is_empty")]
137    pub suggest: HashMap<String, String>,
138
139    #[serde(default, skip_serializing_if = "Option::is_none")]
140    pub support: Option<ComposerPackageSupport>,
141
142    /// Forces the package to be installed into the given subdirectory path. This is used for autoloading PSR-0 packages that do not contain their full path.
143    /// Use forward slashes for cross-platform compatibility
144    #[serde(rename = "target-dir", default, skip_serializing_if = "Option::is_none")]
145    #[deprecated]
146    pub target_dir: Option<String>,
147
148    /// Package release date, in 'YYYY-MM-DD', 'YYYY-MM-DD HH:MM:SS' or 'YYYY-MM-DDTHH:MM:SSZ' format
149    #[serde(default, skip_serializing_if = "Option::is_none")]
150    pub time: Option<String>,
151
152    /// Package type, either 'library' for common packages, 'composer-plugin' for plugins, 'metapackage' for empty packages, or a custom type ([a-z0-9-]+) defined by whatever project this package applies to
153    #[serde(default, skip_serializing_if = "Option::is_none")]
154    pub r#type: Option<ComposerPackageType>,
155
156    /// Package version, see <https://getcomposer.org/doc/04-schema.md#version> for more info on valid schemes
157    #[serde(default, skip_serializing_if = "Option::is_none")]
158    pub version: Option<ComposerPackageVersion>,
159}
160
161/// Indicates whether this package has been abandoned, it can be boolean or a package name/URL pointing to a recommended alternative.
162#[derive(Deserialize, Serialize, Clone, Debug)]
163#[serde(untagged)]
164pub enum ComposerPackageAbandoned {
165    Boolean(bool),
166    String(String),
167}
168
169#[derive(Deserialize, Serialize, Clone, Debug)]
170pub struct ComposerPackageArchive {
171    /// A list of patterns for paths to exclude or include if prefixed with an exclamation mark
172    #[serde(default, skip_serializing_if = "Vec::is_empty")]
173    pub exclude: Vec<String>,
174
175    /// A base name for archive
176    #[serde(default, skip_serializing_if = "Option::is_none")]
177    pub name: Option<String>,
178}
179
180#[derive(Deserialize, Serialize, Clone, Debug)]
181pub struct ComposerPackageAutoloadDev {
182    /// This is an array of paths that contain classes to be included in the class-map generation process
183    #[serde(default, skip_serializing_if = "Vec::is_empty")]
184    pub classmap: Vec<String>,
185
186    /// This is an array of files that are always required on every request
187    #[serde(default, skip_serializing_if = "Vec::is_empty")]
188    pub files: Vec<String>,
189
190    /// This is an object of namespaces (keys) and the directories they can be found into (values, can be arrays of paths) by the autoloader
191    #[serde(rename = "psr-0", default, skip_serializing_if = "HashMap::is_empty")]
192    pub psr_0: HashMap<String, ComposerPackageAutoloadDevPsr0value>,
193
194    /// This is an object of namespaces (keys) and the PSR-4 directories they can map to (values, can be arrays of paths) by the autoloader
195    #[serde(rename = "psr-4", default, skip_serializing_if = "HashMap::is_empty")]
196    pub psr_4: HashMap<String, ComposerPackageAutoloadDevPsr4value>,
197}
198
199#[derive(Deserialize, Serialize, Clone, Debug)]
200#[serde(untagged)]
201pub enum ComposerPackageAutoloadDevPsr0value {
202    Array(Vec<String>),
203    String(String),
204}
205
206#[derive(Deserialize, Serialize, Clone, Debug)]
207#[serde(untagged)]
208pub enum ComposerPackageAutoloadDevPsr4value {
209    Array(Vec<String>),
210    String(String),
211}
212
213#[derive(Deserialize, Serialize, Clone, Debug)]
214#[serde(untagged)]
215pub enum ComposerPackageBin {
216    Array(Vec<String>),
217    String(String),
218}
219
220#[derive(Deserialize, Serialize, Clone, Debug)]
221#[serde(untagged)]
222pub enum ComposerPackageComment {
223    Array(Vec<String>),
224    String(String),
225}
226
227#[derive(Deserialize, Serialize, Clone, Debug)]
228pub struct ComposerPackageConfig {
229    /// Defaults to false. If set to true, Composer will allow install when lock file is not up to date with the latest changes in composer.json
230    #[serde(rename = "allow-missing-requirements", default, skip_serializing_if = "Option::is_none")]
231    pub allow_missing_requirements: Option<bool>,
232
233    /// This is an object of {"pattern": true|false} with packages which are allowed to be loaded as plugins, or true to allow all, false to allow none. Defaults to {} which prompts when an unknown plugin is added
234    #[serde(rename = "allow-plugins", default, skip_serializing_if = "Option::is_none")]
235    pub allow_plugins: Option<ComposerPackageConfigAllowPlugins>,
236
237    /// If true, the Composer autoloader will check for `APCu` and use it to cache found/not-found classes when the extension is enabled, defaults to false
238    #[serde(rename = "apcu-autoloader", default, skip_serializing_if = "Option::is_none")]
239    pub apcu_autoloader: Option<bool>,
240
241    /// The default archive path when not provided on cli, defaults to "."
242    #[serde(rename = "archive-dir", default, skip_serializing_if = "Option::is_none")]
243    pub archive_dir: Option<String>,
244
245    /// The default archiving format when not provided on cli, defaults to "tar"
246    #[serde(rename = "archive-format", default, skip_serializing_if = "Option::is_none")]
247    pub archive_format: Option<String>,
248
249    #[serde(default, skip_serializing_if = "Option::is_none")]
250    pub audit: Option<ComposerPackageConfigAudit>,
251
252    /// Optional string to be used as a suffix for the generated Composer autoloader. When null a random one will be generated
253    #[serde(rename = "autoloader-suffix", default, skip_serializing_if = "Option::is_none")]
254    pub autoloader_suffix: Option<String>,
255
256    /// An object of domain name => bearer authentication token, for example {"example.com":"<token>"}
257    #[serde(default, skip_serializing_if = "HashMap::is_empty")]
258    pub bearer: HashMap<String, String>,
259
260    /// The compatibility of the binaries, defaults to "auto" (automatically guessed), can be "full" (compatible with both Windows and Unix-based systems) and "proxy" (only bash-style proxy)
261    #[serde(rename = "bin-compat", default, skip_serializing_if = "Option::is_none")]
262    pub bin_compat: Option<ComposerPackageConfigBinCompat>,
263
264    /// The location where all binaries are linked, defaults to "vendor/bin"
265    #[serde(rename = "bin-dir", default, skip_serializing_if = "Option::is_none")]
266    pub bin_dir: Option<String>,
267
268    /// An object of domain name => {"consumer-key": "...", "consumer-secret": "..."}
269    #[serde(rename = "bitbucket-oauth", default, skip_serializing_if = "HashMap::is_empty")]
270    pub bitbucket_oauth: HashMap<String, ComposerPackageConfigBitbucketOauthValue>,
271
272    /// Defaults to false and can be any of true, false, "dev"` or "no-dev"`. If set to true, Composer will run the bump command after running the update command. If set to "dev" or "no-dev" then only the corresponding dependencies will be bumped
273    #[serde(rename = "bump-after-update", default, skip_serializing_if = "Option::is_none")]
274    pub bump_after_update: Option<ComposerPackageConfigBumpAfterUpdate>,
275
276    /// The location where all caches are located, defaults to "~/.composer/cache" on *nix and "%LOCALAPPDATA%\\Composer" on windows
277    #[serde(rename = "cache-dir", default, skip_serializing_if = "Option::is_none")]
278    pub cache_dir: Option<String>,
279
280    /// The location where files (zip downloads) are cached, defaults to "{$cache-dir}/files"
281    #[serde(rename = "cache-files-dir", default, skip_serializing_if = "Option::is_none")]
282    pub cache_files_dir: Option<String>,
283
284    /// The cache max size for the files cache, defaults to "300MiB"
285    #[serde(rename = "cache-files-maxsize", default, skip_serializing_if = "Option::is_none")]
286    pub cache_files_maxsize: Option<ComposerPackageConfigCacheFilesMaxsize>,
287
288    /// The cache time-to-live for files, defaults to the value of cache-ttl
289    #[serde(rename = "cache-files-ttl", default, skip_serializing_if = "Option::is_none")]
290    pub cache_files_ttl: Option<usize>,
291
292    /// Whether to use the Composer cache in read-only mode
293    #[serde(rename = "cache-read-only", default, skip_serializing_if = "Option::is_none")]
294    pub cache_read_only: Option<bool>,
295
296    /// The location where repo (git/hg repo clones) are cached, defaults to "{$cache-dir}/repo"
297    #[serde(rename = "cache-repo-dir", default, skip_serializing_if = "Option::is_none")]
298    pub cache_repo_dir: Option<String>,
299
300    /// The default cache time-to-live, defaults to 15552000 (6 months)
301    #[serde(rename = "cache-ttl", default, skip_serializing_if = "Option::is_none")]
302    pub cache_ttl: Option<usize>,
303
304    /// The location where vcs infos (git clones, github api calls, etc. when reading vcs repos) are cached, defaults to "{$cache-dir}/vcs"
305    #[serde(rename = "cache-vcs-dir", default, skip_serializing_if = "Option::is_none")]
306    pub cache_vcs_dir: Option<String>,
307
308    /// A way to set the path to the openssl CA file. In PHP 5.6+ you should rather set this via openssl.cafile in php.ini, although PHP 5.6+ should be able to detect your system CA file automatically
309    #[serde(default, skip_serializing_if = "Option::is_none")]
310    pub cafile: Option<String>,
311
312    /// If cafile is not specified or if the certificate is not found there, the directory pointed to by capath is searched for a suitable certificate. capath must be a correctly hashed certificate directory
313    #[serde(default, skip_serializing_if = "Option::is_none")]
314    pub capath: Option<String>,
315
316    /// If true, the composer autoloader will not scan the filesystem for classes that are not found in the class map, defaults to false
317    #[serde(rename = "classmap-authoritative", default, skip_serializing_if = "Option::is_none")]
318    pub classmap_authoritative: Option<bool>,
319
320    /// The location where old phar files are stored, defaults to "$home" except on XDG Base Directory compliant unixes
321    #[serde(rename = "data-dir", default, skip_serializing_if = "Option::is_none")]
322    pub data_dir: Option<String>,
323
324    /// Defaults to `false`. If set to true all HTTPS URLs will be tried with HTTP instead and no network level encryption is performed. Enabling this is a security risk and is NOT recommended. The better way is to enable the `php_openssl` extension in php.ini
325    #[serde(rename = "disable-tls", default, skip_serializing_if = "Option::is_none")]
326    pub disable_tls: Option<bool>,
327
328    /// The default style of handling dirty updates, defaults to false and can be any of true, false or "stash"
329    #[serde(rename = "discard-changes", default, skip_serializing_if = "Option::is_none")]
330    pub discard_changes: Option<ComposerPackageConfigDiscardChanges>,
331
332    /// A list of domains to use in github mode. This is used for GitHub Enterprise setups, defaults to ["github.com"]
333    #[serde(rename = "github-domains", default, skip_serializing_if = "Vec::is_empty")]
334    pub github_domains: Vec<String>,
335
336    /// Defaults to true. If set to false, the OAuth tokens created to access the github API will have a date instead of the machine hostname
337    #[serde(rename = "github-expose-hostname", default, skip_serializing_if = "Option::is_none")]
338    pub github_expose_hostname: Option<bool>,
339
340    /// An object of domain name => github API oauth tokens, typically {"github.com":"<token>"}
341    #[serde(rename = "github-oauth", default, skip_serializing_if = "HashMap::is_empty")]
342    pub github_oauth: HashMap<String, String>,
343
344    /// A list of protocols to use for github.com clones, in priority order, defaults to ["https", "ssh", "git"]
345    #[serde(rename = "github-protocols", default, skip_serializing_if = "Vec::is_empty")]
346    pub github_protocols: Vec<String>,
347
348    /// A list of domains to use in gitlab mode. This is used for custom GitLab setups, defaults to ["gitlab.com"]
349    #[serde(rename = "gitlab-domains", default, skip_serializing_if = "Vec::is_empty")]
350    pub gitlab_domains: Vec<String>,
351
352    /// An object of domain name => gitlab API oauth tokens, typically {"gitlab.com":{"expires-at":"<expiration date>", "refresh-token":"<refresh token>", "token":"<token>"}}
353    #[serde(rename = "gitlab-oauth", default, skip_serializing_if = "HashMap::is_empty")]
354    pub gitlab_oauth: HashMap<String, ComposerPackageConfigGitlabOauthValue>,
355
356    /// A protocol to force use of when creating a repository URL for the `source` value of the package metadata. One of `git` or `http`. By default, Composer will generate a git URL for private repositories and http one for public repos
357    #[serde(rename = "gitlab-protocol", default, skip_serializing_if = "Option::is_none")]
358    pub gitlab_protocol: Option<ComposerPackageConfigGitlabProtocol>,
359
360    /// An object of domain name => gitlab private tokens, typically {"gitlab.com":"<token>"}, or an object with username and token keys
361    #[serde(rename = "gitlab-token", default, skip_serializing_if = "HashMap::is_empty")]
362    pub gitlab_token: HashMap<String, ComposerPackageConfigGitlabTokenValue>,
363
364    /// Defaults to true. If set to false, Composer will not create .htaccess files in the composer home, cache, and data directories
365    #[serde(rename = "htaccess-protect", default, skip_serializing_if = "Option::is_none")]
366    pub htaccess_protect: Option<bool>,
367
368    /// An object of domain name => {"username": "...", "password": "..."}
369    #[serde(rename = "http-basic", default, skip_serializing_if = "HashMap::is_empty")]
370    pub http_basic: HashMap<String, ComposerPackageConfigHttpBasicValue>,
371
372    /// Defaults to true. If set to false, Composer will not create a composer.lock file
373    #[serde(default, skip_serializing_if = "Option::is_none")]
374    pub lock: Option<bool>,
375
376    /// Composer allows repositories to define a notification URL, so that they get notified whenever a package from that repository is installed. This option allows you to disable that behaviour, defaults to true
377    #[serde(rename = "notify-on-install", default, skip_serializing_if = "Option::is_none")]
378    pub notify_on_install: Option<bool>,
379
380    /// Always optimize when dumping the autoloader
381    #[serde(rename = "optimize-autoloader", default, skip_serializing_if = "Option::is_none")]
382    pub optimize_autoloader: Option<bool>,
383
384    /// This is an object of package name (keys) and version (values) that will be used to mock the platform packages on this machine, the version can be set to false to make it appear like the package is not present
385    #[serde(default, skip_serializing_if = "HashMap::is_empty")]
386    pub platform: HashMap<String, ComposerPackageConfigPlatformValue>,
387
388    /// Defaults to "php-only" which checks only the PHP version. Setting to true will also check the presence of required PHP extensions. If set to false, Composer will not create and require a `platform_check.php` file as part of the autoloader bootstrap
389    #[serde(rename = "platform-check", default, skip_serializing_if = "Option::is_none")]
390    pub platform_check: Option<ComposerPackageConfigPlatformCheck>,
391
392    /// The install method Composer will prefer to use, defaults to auto and can be any of source, dist, auto, or an object of {"pattern": "preference"}
393    #[serde(rename = "preferred-install", default, skip_serializing_if = "Option::is_none")]
394    pub preferred_install: Option<ComposerPackageConfigPreferredInstall>,
395
396    /// If false, the composer autoloader will not be prepended to existing autoloaders, defaults to true
397    #[serde(rename = "prepend-autoloader", default, skip_serializing_if = "Option::is_none")]
398    pub prepend_autoloader: Option<bool>,
399
400    /// The timeout in seconds for process executions, defaults to 300 (5mins)
401    #[serde(rename = "process-timeout", default, skip_serializing_if = "Option::is_none")]
402    pub process_timeout: Option<usize>,
403
404    /// Defaults to `true`. If set to true only HTTPS URLs are allowed to be downloaded via Composer. If you really absolutely need HTTP access to something then you can disable it, but using "Let's Encrypt" to get a free SSL certificate is generally a better alternative
405    #[serde(rename = "secure-http", default, skip_serializing_if = "Option::is_none")]
406    pub secure_http: Option<bool>,
407
408    /// A list of domains which should be trusted/marked as using a secure Subversion/SVN transport. By default svn:// protocol is seen as insecure and will throw. This is a better/safer alternative to disabling `secure-http` altogether
409    #[serde(rename = "secure-svn-domains", default, skip_serializing_if = "Vec::is_empty")]
410    pub secure_svn_domains: Vec<String>,
411
412    /// Defaults to false. If set to true, Composer will sort packages when adding/updating a new dependency
413    #[serde(rename = "sort-packages", default, skip_serializing_if = "Option::is_none")]
414    pub sort_packages: Option<bool>,
415
416    /// What to do after prompting for authentication, one of: true (store), false (do not store) or "prompt" (ask every time), defaults to prompt
417    #[serde(rename = "store-auths", default, skip_serializing_if = "Option::is_none")]
418    pub store_auths: Option<ComposerPackageConfigStoreAuths>,
419
420    /// Defaults to true.  If set to false, globally disables the use of the GitHub API for all GitHub repositories and clones the repository as it would for any other repository
421    #[serde(rename = "use-github-api", default, skip_serializing_if = "Option::is_none")]
422    pub use_github_api: Option<bool>,
423
424    /// If true, the Composer autoloader will also look for classes in the PHP include path
425    #[serde(rename = "use-include-path", default, skip_serializing_if = "Option::is_none")]
426    pub use_include_path: Option<bool>,
427
428    /// When running Composer in a directory where there is no composer.json, if there is one present in a directory above Composer will by default ask you whether you want to use that directory's composer.json instead. One of: true (always use parent if needed), false (never ask or use it) or "prompt" (ask every time), defaults to prompt
429    #[serde(rename = "use-parent-dir", default, skip_serializing_if = "Option::is_none")]
430    pub use_parent_dir: Option<ComposerPackageConfigUseParentDir>,
431
432    /// The location where all packages are installed, defaults to "vendor"
433    #[serde(rename = "vendor-dir", default, skip_serializing_if = "Option::is_none")]
434    pub vendor_dir: Option<String>,
435}
436
437#[derive(Deserialize, Serialize, Clone, Debug)]
438#[serde(untagged)]
439pub enum ComposerPackageConfigAllowPlugins {
440    Boolean(bool),
441    Object(HashMap<String, bool>),
442}
443
444#[derive(Deserialize, Serialize, Clone, Debug)]
445pub struct ComposerPackageConfigAudit {
446    /// Whether abandoned packages should be ignored, reported as problems or cause an audit failure
447    #[serde(default, skip_serializing_if = "Option::is_none")]
448    pub abandoned: Option<ComposerPackageConfigAuditAbandoned>,
449
450    #[serde(default, skip_serializing_if = "Option::is_none")]
451    pub ignore: Option<ComposerPackageConfigAuditIgnore>,
452}
453
454#[derive(Deserialize, Serialize, Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
455pub enum ComposerPackageConfigAuditAbandoned {
456    #[serde(rename = "ignore")]
457    Ignore,
458    #[serde(rename = "report")]
459    Report,
460    #[serde(rename = "fail")]
461    Fail,
462}
463
464#[derive(Deserialize, Serialize, Clone, Debug)]
465#[serde(untagged)]
466pub enum ComposerPackageConfigAuditIgnore {
467    DescribedIdentifiers(HashMap<String, String>),
468    Identifiers(Vec<String>),
469}
470
471#[derive(Deserialize, Serialize, Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
472pub enum ComposerPackageConfigBinCompat {
473    #[serde(rename = "auto")]
474    Auto,
475    #[serde(rename = "full")]
476    Full,
477    #[serde(rename = "proxy")]
478    Proxy,
479    #[serde(rename = "symlink")]
480    Symlink,
481}
482
483#[derive(Deserialize, Serialize, Clone, Debug)]
484pub struct ComposerPackageConfigBitbucketOauthValue {
485    /// The OAuth token retrieved from Bitbucket's API, this is written by Composer and you should not set it nor modify it
486    #[serde(rename = "access-token", default, skip_serializing_if = "Option::is_none")]
487    pub access_token: Option<String>,
488
489    /// The generated token's expiration timestamp, this is written by Composer and you should not set it nor modify it
490    #[serde(rename = "access-token-expiration", default, skip_serializing_if = "Option::is_none")]
491    pub access_token_expiration: Option<isize>,
492
493    /// The consumer-key used for OAuth authentication"]
494    #[serde(rename = "consumer-key")]
495    pub consumer_key: String,
496
497    /// The consumer-secret used for OAuth authentication"]
498    #[serde(rename = "consumer-secret")]
499    pub consumer_secret: String,
500}
501
502#[derive(Deserialize, Serialize, Clone, Debug)]
503#[serde(untagged)]
504pub enum ComposerPackageConfigBumpAfterUpdate {
505    Boolean(bool),
506    String(String),
507}
508
509#[derive(Deserialize, Serialize, Clone, Debug)]
510#[serde(untagged)]
511pub enum ComposerPackageConfigCacheFilesMaxsize {
512    String(String),
513    Integer(usize),
514}
515
516#[derive(Deserialize, Serialize, Clone, Debug)]
517#[serde(untagged)]
518pub enum ComposerPackageConfigDiscardChanges {
519    Boolean(bool),
520    String(String),
521}
522
523#[derive(Deserialize, Serialize, Clone, Debug)]
524#[serde(untagged)]
525pub enum ComposerPackageConfigGitlabOauthValue {
526    Object {
527        /// The expiration date for this GitLab token
528        #[serde(rename = "expires-at", default, skip_serializing_if = "Option::is_none")]
529        expires_at: Option<usize>,
530
531        /// The refresh token used for GitLab authentication
532        #[serde(rename = "refresh-token", default, skip_serializing_if = "Option::is_none")]
533        refresh_token: Option<String>,
534
535        /// The token used for GitLab authentication
536        token: String,
537    },
538    String(String),
539}
540
541#[derive(Deserialize, Serialize, Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
542pub enum ComposerPackageConfigGitlabProtocol {
543    #[serde(rename = "git")]
544    Git,
545    #[serde(rename = "http")]
546    Http,
547    #[serde(rename = "https")]
548    Https,
549}
550
551#[derive(Deserialize, Serialize, Clone, Debug)]
552#[serde(untagged)]
553pub enum ComposerPackageConfigGitlabTokenValue {
554    Object {
555        /// The token used for GitLab authentication"]
556        token: String,
557
558        /// The username used for GitLab authentication"]
559        username: String,
560    },
561    String(String),
562}
563
564#[derive(Deserialize, Serialize, Clone, Debug)]
565pub struct ComposerPackageConfigHttpBasicValue {
566    /// The password used for HTTP Basic authentication"]
567    pub password: String,
568
569    /// The username used for HTTP Basic authentication"]
570    pub username: String,
571}
572
573#[derive(Deserialize, Serialize, Clone, Debug)]
574#[serde(untagged)]
575pub enum ComposerPackageConfigPlatformCheck {
576    Boolean(bool),
577    String(String),
578}
579
580#[derive(Deserialize, Serialize, Clone, Debug)]
581#[serde(untagged)]
582pub enum ComposerPackageConfigPlatformValue {
583    Boolean(bool),
584    String(String),
585}
586
587#[derive(Deserialize, Serialize, Clone, Debug)]
588#[serde(untagged)]
589pub enum ComposerPackageConfigPreferredInstall {
590    Object(HashMap<String, String>),
591    String(String),
592}
593
594#[derive(Deserialize, Serialize, Clone, Debug)]
595#[serde(untagged)]
596pub enum ComposerPackageConfigStoreAuths {
597    Boolean(bool),
598    String(String),
599}
600
601#[derive(Deserialize, Serialize, Clone, Debug)]
602#[serde(untagged)]
603pub enum ComposerPackageConfigUseParentDir {
604    Boolean(bool),
605    String(String),
606}
607
608#[derive(Deserialize, Serialize, Clone, Debug)]
609#[serde(untagged)]
610pub enum ComposerPackageExtra {
611    Object(HashMap<String, Value>),
612    Array(Vec<String>),
613}
614
615#[derive(Deserialize, Serialize, Clone, Debug)]
616pub struct ComposerPackageFundingItem {
617    /// Type of funding or platform through which funding is possible
618    #[serde(default, skip_serializing_if = "Option::is_none")]
619    pub r#type: Option<String>,
620
621    /// URL to a website with details on funding and a way to fund the package
622    #[serde(default, skip_serializing_if = "Option::is_none")]
623    pub url: Option<String>,
624}
625
626#[derive(Deserialize, Serialize, Clone, Debug)]
627#[serde(untagged)]
628pub enum ComposerPackageLicense {
629    Array(Vec<String>),
630    String(String),
631}
632
633#[derive(Deserialize, Serialize, Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
634pub enum ComposerPackageMinimumStability {
635    #[serde(rename = "dev")]
636    Dev,
637    #[serde(rename = "alpha")]
638    Alpha,
639    #[serde(rename = "beta")]
640    Beta,
641    #[serde(rename = "rc", alias = "RC")]
642    Rc,
643    #[serde(rename = "stable")]
644    Stable,
645}
646
647#[derive(Serialize, Deserialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
648pub struct ComposerPackageName(pub String);
649
650#[derive(Deserialize, Serialize, Clone, Debug)]
651pub struct ComposerPackagePhpExt {
652    /// These configure options make up the flags that can be passed to ./configure when installing the extension
653    #[serde(rename = "configure-options", default, skip_serializing_if = "Vec::is_empty")]
654    pub configure_options: Vec<ComposerPackagePhpExtConfigureOptionsItem>,
655
656    /// If specified, this will be used as the name of the extension, where needed by tooling. If this is not specified, the extension name will be derived from the Composer package name (e.g. `vendor/name` would become `ext-name`). The extension name may be specified with or without the `ext-` prefix, and tools that use this must normalise this appropriately
657    #[serde(rename = "extension-name", default, skip_serializing_if = "Option::is_none")]
658    pub extension_name: Option<String>,
659
660    /// This is used to add a prefix to the INI file, e.g. `90-xdebug.ini` which affects the loading order. The priority is a number in the range 10-99 inclusive, with 10 being the highest priority (i.e. will be processed first), and 99 being the lowest priority (i.e. will be processed last). There are two digits so that the files sort correctly on any platform, whether the sorting is natural or not
661    #[serde(default = "default_composer_package_php_ext_priority")]
662    pub priority: usize,
663
664    /// Does this package support non-Thread Safe mode"]
665    #[serde(rename = "support-nts", default = "default_composer_package_php_ext_support_nts")]
666    pub support_nts: bool,
667
668    /// Does this package support Zend Thread Safety"]
669    #[serde(rename = "support-zts", default = "default_composer_package_php_ext_support_zts")]
670    pub support_zts: bool,
671}
672
673#[derive(Deserialize, Serialize, Clone, Debug)]
674pub struct ComposerPackagePhpExtConfigureOptionsItem {
675    /// The description of what the flag does or means
676    #[serde(default, skip_serializing_if = "Option::is_none")]
677    pub description: Option<String>,
678
679    /// The name of the flag, this would typically be prefixed with `--`, for example, the value 'the-flag' would be passed as `./configure --the-flag`
680    pub name: ComposerPackagePhpExtConfigureOptionsItemName,
681
682    /// If this is set to true, the flag needs a value (e.g. --with-somelib=<path>), otherwise it is a flag without a value (e.g. --enable-some-feature)
683    #[serde(rename = "needs-value", default)]
684    pub needs_value: bool,
685}
686
687#[derive(Serialize, Deserialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
688pub struct ComposerPackagePhpExtConfigureOptionsItemName(pub String);
689
690#[derive(Deserialize, Serialize, Clone, Debug)]
691#[serde(untagged)]
692pub enum ComposerPackageRepositories {
693    Object(HashMap<String, ComposerPackageRepositoriesObjectValue>),
694    Array(Vec<ComposerPackageRepositoriesArrayItem>),
695}
696
697#[derive(Deserialize, Serialize, Clone, Debug)]
698#[serde(untagged)]
699pub enum ComposerPackageRepositoriesArrayItem {
700    Repository(Box<Repository>),
701    Map(HashMap<String, bool>),
702}
703
704#[derive(Deserialize, Serialize, Clone, Debug)]
705#[serde(untagged)]
706pub enum ComposerPackageRepositoriesObjectValue {
707    Repository(Box<Repository>),
708    Enabled(bool),
709}
710
711#[derive(Deserialize, Serialize, Clone, Debug)]
712pub struct ComposerPackageScripts {
713    /// Occurs after the autoloader is dumped, contains one or more `Class::method` callables or shell commands
714    #[serde(rename = "post-autoload-dump", default, skip_serializing_if = "Option::is_none")]
715    pub post_autoload_dump: Option<ComposerPackageScriptsCallback>,
716
717    /// Occurs after the create-project command is executed, contains one or more `Class::method` callables or shell commands
718    #[serde(rename = "post-create-project-cmd", default, skip_serializing_if = "Option::is_none")]
719    pub post_create_project_cmd: Option<ComposerPackageScriptsCallback>,
720
721    /// Occurs after the install command is executed, contains one or more `Class::method` callables or shell commands
722    #[serde(rename = "post-install-cmd", default, skip_serializing_if = "Option::is_none")]
723    pub post_install_cmd: Option<ComposerPackageScriptsCallback>,
724
725    /// Occurs after a package is installed, contains one or more `Class::method` callables or shell commands
726    #[serde(rename = "post-package-install", default, skip_serializing_if = "Option::is_none")]
727    pub post_package_install: Option<ComposerPackageScriptsCallback>,
728
729    /// Occurs after a package has been uninstalled, contains one or more `Class::method` callables or shell commands
730    #[serde(rename = "post-package-uninstall", default, skip_serializing_if = "Option::is_none")]
731    pub post_package_uninstall: Option<ComposerPackageScriptsCallback>,
732
733    /// Occurs after a package is updated, contains one or more `Class::method` callables or shell commands
734    #[serde(rename = "post-package-update", default, skip_serializing_if = "Option::is_none")]
735    pub post_package_update: Option<ComposerPackageScriptsCallback>,
736
737    /// Occurs after the root-package is installed, contains one or more `Class::method` callables or shell commands
738    #[serde(rename = "post-root-package-install", default, skip_serializing_if = "Option::is_none")]
739    pub post_root_package_install: Option<ComposerPackageScriptsCallback>,
740
741    /// Occurs after the status command is executed, contains one or more `Class::method` callables or shell commands
742    #[serde(rename = "post-status-cmd", default, skip_serializing_if = "Option::is_none")]
743    pub post_status_cmd: Option<ComposerPackageScriptsCallback>,
744
745    /// Occurs after the update command is executed, contains one or more `Class::method` callables or shell commands
746    #[serde(rename = "post-update-cmd", default, skip_serializing_if = "Option::is_none")]
747    pub post_update_cmd: Option<ComposerPackageScriptsCallback>,
748
749    /// Occurs before the autoloader is dumped, contains one or more `Class::method` callables or shell commands
750    #[serde(rename = "pre-autoload-dump", default, skip_serializing_if = "Option::is_none")]
751    pub pre_autoload_dump: Option<ComposerPackageScriptsCallback>,
752
753    /// Occurs before the install command is executed, contains one or more `Class::method` callables or shell commands
754    #[serde(rename = "pre-install-cmd", default, skip_serializing_if = "Option::is_none")]
755    pub pre_install_cmd: Option<ComposerPackageScriptsCallback>,
756
757    /// Occurs before a package is installed, contains one or more `Class::method` callables or shell commands
758    #[serde(rename = "pre-package-install", default, skip_serializing_if = "Option::is_none")]
759    pub pre_package_install: Option<ComposerPackageScriptsCallback>,
760
761    /// Occurs before a package has been uninstalled, contains one or more `Class::method` callables or shell commands
762    #[serde(rename = "pre-package-uninstall", default, skip_serializing_if = "Option::is_none")]
763    pub pre_package_uninstall: Option<ComposerPackageScriptsCallback>,
764
765    /// Occurs before a package is updated, contains one or more `Class::method` callables or shell commands
766    #[serde(rename = "pre-package-update", default, skip_serializing_if = "Option::is_none")]
767    pub pre_package_update: Option<ComposerPackageScriptsCallback>,
768
769    /// Occurs before the status command is executed, contains one or more `Class::method` callables or shell commands
770    #[serde(rename = "pre-status-cmd", default, skip_serializing_if = "Option::is_none")]
771    pub pre_status_cmd: Option<ComposerPackageScriptsCallback>,
772
773    /// Occurs before the update command is executed, contains one or more `Class::method` callables or shell commands
774    #[serde(rename = "pre-update-cmd", default, skip_serializing_if = "Option::is_none")]
775    pub pre_update_cmd: Option<ComposerPackageScriptsCallback>,
776}
777
778#[derive(Deserialize, Serialize, Clone, Debug)]
779#[serde(untagged)]
780pub enum ComposerPackageScriptsCallback {
781    One(String),
782    Many(Vec<String>),
783}
784
785#[derive(Deserialize, Serialize, Clone, Debug)]
786pub struct ComposerPackageSupport {
787    /// URL to the support chat
788    #[serde(default, skip_serializing_if = "Option::is_none")]
789    pub chat: Option<String>,
790
791    /// URL to the documentation
792    #[serde(default, skip_serializing_if = "Option::is_none")]
793    pub docs: Option<String>,
794
795    /// Email address for support
796    #[serde(default, skip_serializing_if = "Option::is_none")]
797    pub email: Option<String>,
798
799    /// URL to the forum
800    #[serde(default, skip_serializing_if = "Option::is_none")]
801    pub forum: Option<String>,
802
803    /// IRC channel for support, as <irc://server/channel>
804    #[serde(default, skip_serializing_if = "Option::is_none")]
805    pub irc: Option<String>,
806
807    /// URL to the issue tracker
808    #[serde(default, skip_serializing_if = "Option::is_none")]
809    pub issues: Option<String>,
810
811    /// URL to the RSS feed
812    #[serde(default, skip_serializing_if = "Option::is_none")]
813    pub rss: Option<String>,
814
815    /// URL to the vulnerability disclosure policy (VDP)
816    #[serde(default, skip_serializing_if = "Option::is_none")]
817    pub security: Option<String>,
818
819    /// URL to browse or download the sources
820    #[serde(default, skip_serializing_if = "Option::is_none")]
821    pub source: Option<String>,
822
823    /// URL to the wiki
824    #[serde(default, skip_serializing_if = "Option::is_none")]
825    pub wiki: Option<String>,
826}
827
828#[derive(Serialize, Deserialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
829pub struct ComposerPackageType(pub String);
830
831#[derive(Serialize, Deserialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
832pub struct ComposerPackageVersion(pub String);
833
834#[derive(Deserialize, Serialize, Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
835pub enum ArtifactRepositoryType {
836    #[serde(rename = "artifact")]
837    Artifact,
838}
839
840#[derive(Deserialize, Serialize, Clone, Debug)]
841pub struct ArtifactRepository {
842    pub r#type: ArtifactRepositoryType,
843    pub url: String,
844    #[serde(default, skip_serializing_if = "Option::is_none")]
845    pub canonical: Option<bool>,
846    #[serde(default, skip_serializing_if = "Vec::is_empty")]
847    pub exclude: Vec<String>,
848    #[serde(default, skip_serializing_if = "Vec::is_empty")]
849    pub only: Vec<String>,
850}
851
852#[derive(Deserialize, Serialize, Clone, Debug)]
853pub struct Authors(pub Vec<AuthorsItem>);
854
855#[derive(Deserialize, Serialize, Clone, Debug)]
856#[serde(deny_unknown_fields)]
857pub struct AuthorsItem {
858    /// Email address of the author
859    #[serde(default, skip_serializing_if = "Option::is_none")]
860    pub email: Option<String>,
861
862    /// Homepage URL for the author
863    #[serde(default, skip_serializing_if = "Option::is_none")]
864    pub homepage: Option<String>,
865
866    /// Full name of the author
867    pub name: String,
868
869    /// Author's role in the project
870    #[serde(default, skip_serializing_if = "Option::is_none")]
871    pub role: Option<String>,
872}
873
874#[derive(Deserialize, Serialize, Clone, Debug)]
875pub struct Autoload {
876    /// This is an array of paths that contain classes to be included in the class-map generation process
877    #[serde(default, skip_serializing_if = "Vec::is_empty")]
878    pub classmap: Vec<String>,
879
880    /// This is an array of patterns to exclude from autoload classmap generation. (e.g. "exclude-from-classmap": ["/test/", "/tests/", "/Tests/"]"]
881    #[serde(rename = "exclude-from-classmap", default, skip_serializing_if = "Vec::is_empty")]
882    pub exclude_from_classmap: Vec<String>,
883
884    /// This is an array of files that are always required on every request
885    #[serde(default, skip_serializing_if = "Vec::is_empty")]
886    pub files: Vec<String>,
887
888    /// This is an object of namespaces (keys) and the directories they can be found in (values, can be arrays of paths) by the autoloader
889    #[serde(rename = "psr-0", default, skip_serializing_if = "HashMap::is_empty")]
890    pub psr_0: HashMap<String, AutoloadPsr0value>,
891
892    /// This is an object of namespaces (keys) and the PSR-4 directories they can map to (values, can be arrays of paths) by the autoloader
893    #[serde(rename = "psr-4", default, skip_serializing_if = "HashMap::is_empty")]
894    pub psr_4: HashMap<String, AutoloadPsr4value>,
895}
896
897#[derive(Deserialize, Serialize, Clone, Debug)]
898#[serde(untagged)]
899pub enum AutoloadPsr0value {
900    Array(Vec<String>),
901    String(String),
902}
903
904#[derive(Deserialize, Serialize, Clone, Debug)]
905#[serde(untagged)]
906pub enum AutoloadPsr4value {
907    Array(Vec<String>),
908    String(String),
909}
910
911#[derive(Deserialize, Serialize, Clone, Debug)]
912pub struct ComposerRepository {
913    pub r#type: ComposerRepositoryType,
914
915    pub url: String,
916
917    #[serde(default, skip_serializing_if = "Option::is_none")]
918    pub allow_ssl_downgrade: Option<bool>,
919
920    #[serde(default, skip_serializing_if = "Option::is_none")]
921    pub canonical: Option<bool>,
922
923    #[serde(default, skip_serializing_if = "Vec::is_empty")]
924    pub exclude: Vec<String>,
925
926    #[serde(rename = "force-lazy-providers", default, skip_serializing_if = "Option::is_none")]
927    pub force_lazy_providers: Option<bool>,
928
929    #[serde(default, skip_serializing_if = "Vec::is_empty")]
930    pub only: Vec<String>,
931
932    #[serde(default, skip_serializing_if = "HashMap::is_empty")]
933    pub options: HashMap<String, Value>,
934}
935
936#[derive(Deserialize, Serialize, Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
937pub enum ComposerRepositoryType {
938    #[serde(rename = "composer")]
939    Composer,
940}
941
942#[derive(Deserialize, Serialize, Clone, Debug)]
943pub struct Dist {
944    pub r#type: String,
945
946    pub url: String,
947
948    #[serde(default, skip_serializing_if = "Vec::is_empty")]
949    pub mirrors: Vec<Value>,
950
951    #[serde(default, skip_serializing_if = "Option::is_none")]
952    pub reference: Option<String>,
953
954    #[serde(default, skip_serializing_if = "Option::is_none")]
955    pub shasum: Option<String>,
956}
957
958#[derive(Deserialize, Serialize, Clone, Debug)]
959pub struct InlinePackage {
960    /// Package name, including 'vendor-name/' prefix
961    pub name: String,
962
963    pub version: String,
964
965    #[serde(default, skip_serializing_if = "Option::is_none")]
966    pub archive: Option<InlinePackageArchive>,
967
968    #[serde(default, skip_serializing_if = "Option::is_none")]
969    pub authors: Option<Authors>,
970
971    #[serde(default, skip_serializing_if = "Option::is_none")]
972    pub autoload: Option<Autoload>,
973
974    /// A set of files, or a single file, that should be treated as binaries and symlinked into bin-dir (from config)
975    #[serde(default, skip_serializing_if = "Option::is_none")]
976    pub bin: Option<InlinePackageBin>,
977
978    #[serde(default, skip_serializing_if = "HashMap::is_empty")]
979    pub conflict: HashMap<String, String>,
980
981    #[serde(default, skip_serializing_if = "Option::is_none")]
982    pub description: Option<String>,
983
984    #[serde(default, skip_serializing_if = "Option::is_none")]
985    pub dist: Option<Dist>,
986
987    #[serde(default, skip_serializing_if = "Option::is_none")]
988    pub extra: Option<InlinePackageExtra>,
989
990    #[serde(default, skip_serializing_if = "Option::is_none")]
991    pub homepage: Option<String>,
992
993    /// A list of directories which should get added to PHP's include path.
994    #[serde(rename = "include-path", default, skip_serializing_if = "Vec::is_empty")]
995    #[deprecated(
996        note = "this is only present to support legacy projects, and all new code should preferably use autoloading"
997    )]
998    pub include_path: Vec<String>,
999
1000    #[serde(default, skip_serializing_if = "Vec::is_empty")]
1001    pub keywords: Vec<String>,
1002
1003    #[serde(default, skip_serializing_if = "Option::is_none")]
1004    pub license: Option<InlinePackageLicense>,
1005
1006    #[serde(default, skip_serializing_if = "HashMap::is_empty")]
1007    pub provide: HashMap<String, String>,
1008
1009    #[serde(default, skip_serializing_if = "HashMap::is_empty")]
1010    pub replace: HashMap<String, String>,
1011
1012    #[serde(default, skip_serializing_if = "HashMap::is_empty")]
1013    pub require: HashMap<String, String>,
1014
1015    #[serde(rename = "require-dev", default, skip_serializing_if = "HashMap::is_empty")]
1016    pub require_dev: HashMap<String, String>,
1017
1018    #[serde(default, skip_serializing_if = "Option::is_none")]
1019    pub source: Option<Source>,
1020
1021    #[serde(default, skip_serializing_if = "HashMap::is_empty")]
1022    pub suggest: HashMap<String, String>,
1023
1024    #[serde(rename = "target-dir", default, skip_serializing_if = "Option::is_none")]
1025    #[deprecated]
1026    pub target_dir: Option<String>,
1027
1028    #[serde(default, skip_serializing_if = "Option::is_none")]
1029    pub time: Option<String>,
1030
1031    #[serde(default, skip_serializing_if = "Option::is_none")]
1032    pub r#type: Option<String>,
1033}
1034
1035#[derive(Deserialize, Serialize, Clone, Debug)]
1036pub struct InlinePackageArchive {
1037    #[serde(default, skip_serializing_if = "Vec::is_empty")]
1038    pub exclude: Vec<Value>,
1039}
1040
1041#[derive(Deserialize, Serialize, Clone, Debug)]
1042#[serde(untagged)]
1043pub enum InlinePackageBin {
1044    One(String),
1045    Many(Vec<String>),
1046}
1047
1048#[derive(Deserialize, Serialize, Clone, Debug)]
1049#[serde(untagged)]
1050pub enum InlinePackageExtra {
1051    Object(HashMap<String, Value>),
1052    Array(Vec<Value>),
1053}
1054
1055#[derive(Deserialize, Serialize, Clone, Debug)]
1056#[serde(untagged)]
1057pub enum InlinePackageLicense {
1058    One(String),
1059    Many(Vec<String>),
1060}
1061
1062#[derive(Deserialize, Serialize, Clone, Debug)]
1063pub struct PackageRepository {
1064    pub r#type: PackageRepositoryType,
1065
1066    pub package: PackageRepositoryPackage,
1067
1068    #[serde(default, skip_serializing_if = "Option::is_none")]
1069    pub canonical: Option<bool>,
1070
1071    #[serde(default, skip_serializing_if = "Vec::is_empty")]
1072    pub exclude: Vec<String>,
1073
1074    #[serde(default, skip_serializing_if = "Vec::is_empty")]
1075    pub only: Vec<String>,
1076}
1077
1078#[derive(Deserialize, Serialize, Clone, Debug)]
1079#[serde(untagged)]
1080pub enum PackageRepositoryPackage {
1081    One(InlinePackage),
1082    Many(Vec<InlinePackage>),
1083}
1084
1085#[derive(Deserialize, Serialize, Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1086pub enum PackageRepositoryType {
1087    #[serde(rename = "package")]
1088    Package,
1089}
1090
1091#[derive(Deserialize, Serialize, Clone, Debug)]
1092pub struct PathRepository {
1093    #[serde(default, skip_serializing_if = "Option::is_none")]
1094    pub canonical: Option<bool>,
1095    #[serde(default, skip_serializing_if = "Vec::is_empty")]
1096    pub exclude: Vec<String>,
1097    #[serde(default, skip_serializing_if = "Vec::is_empty")]
1098    pub only: Vec<String>,
1099    #[serde(default, skip_serializing_if = "Option::is_none")]
1100    pub options: Option<PathRepositoryOptions>,
1101    #[serde(rename = "type")]
1102    pub type_: PathRepositoryType,
1103    pub url: String,
1104}
1105
1106#[derive(Deserialize, Serialize, Clone, Debug)]
1107pub struct PathRepositoryOptions {
1108    #[serde(default, skip_serializing_if = "Option::is_none")]
1109    pub symlink: Option<bool>,
1110}
1111
1112#[derive(Deserialize, Serialize, Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1113pub enum PathRepositoryType {
1114    #[serde(rename = "path")]
1115    Path,
1116}
1117
1118#[derive(Deserialize, Serialize, Clone, Debug)]
1119pub struct PearRepository {
1120    pub r#type: PearRepositoryType,
1121    pub url: String,
1122
1123    #[serde(default, skip_serializing_if = "Option::is_none")]
1124    pub canonical: Option<bool>,
1125
1126    #[serde(default, skip_serializing_if = "Vec::is_empty")]
1127    pub exclude: Vec<String>,
1128
1129    #[serde(default, skip_serializing_if = "Vec::is_empty")]
1130    pub only: Vec<String>,
1131
1132    #[serde(rename = "vendor-alias", default, skip_serializing_if = "Option::is_none")]
1133    pub vendor_alias: Option<String>,
1134}
1135
1136#[derive(Deserialize, Serialize, Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1137pub enum PearRepositoryType {
1138    #[serde(rename = "pear")]
1139    Pear,
1140}
1141
1142#[derive(Deserialize, Serialize, Clone, Debug)]
1143#[serde(untagged)]
1144pub enum Repository {
1145    Composer(ComposerRepository),
1146    Vcs(VcsRepository),
1147    Path(PathRepository),
1148    Artifact(ArtifactRepository),
1149    Pear(PearRepository),
1150    Package(PackageRepository),
1151}
1152
1153#[derive(Deserialize, Serialize, Clone, Debug)]
1154pub struct Source {
1155    pub r#type: String,
1156
1157    pub url: String,
1158
1159    #[serde(default, skip_serializing_if = "Vec::is_empty")]
1160    pub mirrors: Vec<Value>,
1161
1162    pub reference: String,
1163}
1164
1165#[derive(Deserialize, Serialize, Clone, Debug)]
1166pub struct VcsRepository {
1167    pub r#type: VcsRepositoryType,
1168    pub url: String,
1169
1170    #[serde(default, skip_serializing_if = "Option::is_none")]
1171    pub branch: Option<String>,
1172
1173    #[serde(rename = "branches-path", default, skip_serializing_if = "Option::is_none")]
1174    pub branches_path: Option<VcsRepositoryBranchesPath>,
1175
1176    #[serde(default, skip_serializing_if = "Option::is_none")]
1177    pub canonical: Option<bool>,
1178
1179    #[serde(default, skip_serializing_if = "Option::is_none")]
1180    pub depot: Option<String>,
1181
1182    #[serde(default, skip_serializing_if = "Vec::is_empty")]
1183    pub exclude: Vec<String>,
1184
1185    #[serde(rename = "no-api", default, skip_serializing_if = "Option::is_none")]
1186    pub no_api: Option<bool>,
1187
1188    #[serde(default, skip_serializing_if = "Vec::is_empty")]
1189    pub only: Vec<String>,
1190
1191    #[serde(default, skip_serializing_if = "Option::is_none")]
1192    pub p4password: Option<String>,
1193
1194    #[serde(default, skip_serializing_if = "Option::is_none")]
1195    pub p4user: Option<String>,
1196
1197    #[serde(rename = "package-path", default, skip_serializing_if = "Option::is_none")]
1198    pub package_path: Option<String>,
1199
1200    #[serde(rename = "secure-http", default, skip_serializing_if = "Option::is_none")]
1201    pub secure_http: Option<bool>,
1202
1203    #[serde(rename = "svn-cache-credentials", default, skip_serializing_if = "Option::is_none")]
1204    pub svn_cache_credentials: Option<bool>,
1205
1206    #[serde(rename = "tags-path", default, skip_serializing_if = "Option::is_none")]
1207    pub tags_path: Option<VcsRepositoryTagsPath>,
1208
1209    #[serde(rename = "trunk-path", default, skip_serializing_if = "Option::is_none")]
1210    pub trunk_path: Option<VcsRepositoryTrunkPath>,
1211
1212    #[serde(default, skip_serializing_if = "Option::is_none")]
1213    pub unique_perforce_client_name: Option<String>,
1214}
1215
1216#[derive(Deserialize, Serialize, Clone, Debug)]
1217#[serde(untagged)]
1218pub enum VcsRepositoryBranchesPath {
1219    Boolean(bool),
1220    String(String),
1221}
1222
1223#[derive(Deserialize, Serialize, Clone, Debug)]
1224#[serde(untagged)]
1225pub enum VcsRepositoryTagsPath {
1226    Boolean(bool),
1227    String(String),
1228}
1229
1230#[derive(Deserialize, Serialize, Clone, Debug)]
1231#[serde(untagged)]
1232pub enum VcsRepositoryTrunkPath {
1233    Boolean(bool),
1234    String(String),
1235}
1236
1237#[derive(Deserialize, Serialize, Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1238pub enum VcsRepositoryType {
1239    #[serde(rename = "vcs")]
1240    Vcs,
1241    #[serde(rename = "github")]
1242    Github,
1243    #[serde(rename = "git")]
1244    Git,
1245    #[serde(rename = "gitlab")]
1246    Gitlab,
1247    #[serde(rename = "bitbucket")]
1248    Bitbucket,
1249    #[serde(rename = "git-bitbucket")]
1250    GitBitbucket,
1251    #[serde(rename = "hg")]
1252    Hg,
1253    #[serde(rename = "fossil")]
1254    Fossil,
1255    #[serde(rename = "perforce")]
1256    Perforce,
1257    #[serde(rename = "svn")]
1258    Svn,
1259}
1260
1261const fn default_composer_package_php_ext_priority() -> usize {
1262    80
1263}
1264
1265const fn default_composer_package_php_ext_support_nts() -> bool {
1266    true
1267}
1268
1269const fn default_composer_package_php_ext_support_zts() -> bool {
1270    true
1271}