Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

composer.json type property became case sensitive in 1.9.1? #8411

Closed
chris-kruining opened this issue Nov 4, 2019 · 9 comments
Labels

Comments

@chris-kruining
Copy link

@chris-kruining chris-kruining commented Nov 4, 2019

$ composer install

[Composer\Json\JsonValidationException]
"./composer.json" does not match the expected JSON schema:

  • type : Does not match the regex pattern ^[a-z0-9-]+$

The command "composer install" failed and exited with 1 during .

with the following json

{
    "name": "chris-kruining/utilities",
    "type": "Utilities",
    "description": "Utilities for PHP 7.1^",
    "keywords": ["Utilities","PHP"],
    "homepage": "https://github.com/chris-kruining/utilities",
    "license": "GPL-3.0-or-later",
    "authors": [
        {
            "name": "Chris Kruining",
            "email": "chris@kruining.eu",
            "homepage": "https://github.com/chris-kruining",
            "role": "Developer"
        }
    ],
    "require": {
        "php": ">=7.1.0",
        "psr/container": "1.0.0",
        "nesbot/carbon": "2.25.3",
        "composer/composer": "1.9.1"
    },
    "require-dev": {
        "phpunit/phpunit": "8.4.0",
        "phpspec/phpspec": "6.0.0",
        "php-coveralls/php-coveralls": "2.1.0"
    },
    "provide": {
        "psr/container-implementation": "1.0"
    },
    "config": {
      "bin-dir": "bin"
    },
    "autoload": {
        "psr-4": {
            "CPB\\Utilities\\": "src/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "spec\\": "spec/"
        }
    }
}

I've had this config with a capital 'U' for as long as I can remember. Is this an issue or is it deliberate?

@alcohol

This comment has been minimized.

Copy link
Member

@alcohol alcohol commented Nov 4, 2019

Commits show this was indeed changed. Before there was no validation at all. Your type is not one of the four supported types officially (though extensions/plugins can add support for additional types here). See documentation at https://getcomposer.org/doc/04-schema.md#type

@alcohol

This comment has been minimized.

Copy link
Member

@alcohol alcohol commented Nov 4, 2019

@Seldaek any specific reason you can think of that this was made case-sensitive?

@alcohol alcohol added the Support label Nov 4, 2019
@stof

This comment has been minimized.

Copy link
Contributor

@stof stof commented Nov 4, 2019

I don't think that the change was about making this case-sensitive, but about making this following a strict pattern rather than being free-form. Even if we were allowing capital letters in the schema, the change would still render some other values invalid (accents, emojis, etc...)

@chris-kruining

This comment has been minimized.

Copy link
Author

@chris-kruining chris-kruining commented Nov 4, 2019

I don't think that the change was about making this case-sensitive, but about making this following a strict pattern rather than being free-form. Even if we were allowing capital letters in the schema, the change would still render some other values invalid (accents, emojis, etc...)

Ergo, it is deliberate and I should fix my json conf?

@Seldaek

This comment has been minimized.

Copy link
Member

@Seldaek Seldaek commented Nov 6, 2019

Please update to lowercase, and generally speaking I'd say refrain from defining random types like Utilities which have no meaning. The type is meant for installers to know how the package should be installed, and all the known types are lowercased strings following ^[a-z0-9-]+$. There is really no reason to define the type property otherwise. See https://getcomposer.org/doc/04-schema.md#type

@Seldaek Seldaek closed this Nov 6, 2019
@chris-kruining

This comment has been minimized.

Copy link
Author

@chris-kruining chris-kruining commented Nov 6, 2019

Ok, will do. Thanks!

@EnoahNetzach

This comment has been minimized.

Copy link

@EnoahNetzach EnoahNetzach commented Nov 6, 2019

Shouldn't this be a breaking change?

As per 1.9.0 there is a warning:

Deprecation warning: Your package name [...] is invalid, it should have a vendor name, a forward slash, and a package name. The vendor and package name can be words separated by -, . or _. The complete name should match "[a-z0-9]([_.-]?[a-z0-9]+)*/[a-z0-9]([_.-]?[a-z0-9]+)*". Make sure you fix this as Composer 2.0 will error.

Suddenly all the builds are breaking for no discernible reason..

@alcohol

This comment has been minimized.

Copy link
Member

@alcohol alcohol commented Nov 7, 2019

The name field validation was introduced quite a while ago. This issue is regarding the type field validation. Please do not mix up the two of them in the same issue.

@Seldaek

This comment has been minimized.

Copy link
Member

@Seldaek Seldaek commented Nov 7, 2019

Also the name validation is just a warning so I doubt it's breaking your builds.. You should fix it though before it does.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.