composer: repositories[0].type : Does not have a value in the enumeration ["composer"]

https://getcomposer.org/doc/05-repositories.md#package-2

root$ lsb_release -a | grep Desc
Description:	Ubuntu 24.04.1 LTS

root$ composer --version
Composer version 2.7.1 2024-02-09 15:26:28

root$ cat composer.json 
{
    "repositories": [
        {
            "type": "package",
            "url": "../depend"
        }
    ]
}

root$ composer validate

In Factory.php line 320:
                                                                                                                      
  "./composer.json" does not match the expected JSON schema:                                                          
   - repositories[0].type : Does not have a value in the enumeration ["composer"]                                     
   - repositories[0].type : Does not have a value in the enumeration ["vcs","github","git","gitlab","bitbucket","git  
  -bitbucket","hg","fossil","perforce","svn"]                                                                         
   - repositories[0].type : Does not have a value in the enumeration ["path"]                                         
   - repositories[0].type : Does not have a value in the enumeration ["artifact"]                                     
   - repositories[0].type : Does not have a value in the enumeration ["pear"]                                         
   - repositories[0].package : The property package is required                                                       
   - repositories[0] : Failed to match at least one schema                                                            
   - repositories[0] : Must contain no more than 1 properties                                                         
   - repositories[0].type : String value found, but a boolean is required                                             
   - repositories[0].type : Does not have a value in the enumeration [false]                                          
   - repositories[0].url : String value found, but a boolean is required                                              
   - repositories[0].url : Does not have a value in the enumeration [false]                                           
                                                                                                                      

validate [--no-check-all] [--check-lock] [--no-check-lock] [--no-check-publish] [--no-check-version] [-A|--with-dependencies] [--strict] [--] [<file>]

** - repositories[0].type : Does not have a value in the enumeration [“composer”]

  • repositories[0].type : Does not have a value in the enumeration [“vcs”,“github”,“git”,“gitlab”,“bitbucket”,“git
    -bitbucket”,“hg”,“fossil”,“perforce”,“svn”]**

Why?

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Comments: 15 (8 by maintainers)

Most upvoted comments

Because in your second example you are defining a package repository. A package repository is meant to be used for dependencies that don’t have Composer support. With that all the information about the package have to be included in the root composer.json file (i.e. the one in depend is not evaluated).

The type package does not expect a url key but a package key containing all the metadata of the package (i.e. the content of what would be in the composer.json file if that package was already supporting composer).

Your code snippet does not correspond to the documentation you linked.