Skip to content

Refuses to normalize projects without name/description #349

@guilliamxavier

Description

@guilliamxavier

I'm starting a private project that won't be published so doesn't have a name (nor a description); here's its composer.json (minimal for now):

{
    "type": "project",
    "license": "proprietary",
    "require": {
        "php": "^7.2"
    }
}

It is valid for non-public use:

$ composer validate --no-check-publish
./composer.json is valid for simple usage with composer but has
strict errors that make it unable to be published as a package:
See https://getcomposer.org/doc/04-schema.md for details on the schema
name : The property name is required
description : The property description is required
$ echo $?
0

but impossible to normalize as-is:

$ composer normalize
Original JSON is not valid according to schema "file:///home/gx/.composer/vendor/ergebnis/composer-normalize/src/../resource/schema.json".
./composer.json is valid for simple usage with composer but has
strict errors that make it unable to be published as a package:
See https://getcomposer.org/doc/04-schema.md for details on the schema
$ echo $?
0

(note: the message doesn't say what the strict errors are, and the command doesn't return an error code despite not being successful).

To work around, I have to run the sequence:

  1. composer config name a/a (dummy but valid name)
  2. composer config description ""
  3. composer update --lock (if I have a composer.lock)
  4. composer normalize
  5. composer config --unset name
  6. composer config --unset description
  7. composer update --lock (if I have a composer.lock)

Would it be feasible to mimic --no-check-publish (possibly opt-in)?

Maybe related to #297

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions