Skip to content

[BUG] [PHP] Generate correct composer.json metadata #14645

@Poolmann

Description

@Poolmann

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

I noticed, that not all metadata properties in the composer.json file are exposed to the outside.

  • "name": depends on the git_id/git_repo
  • "version": comes from the artifactVersion setting in additional-properties in the cli
  • "description": from the .yaml spec
  • "homepage", "license", "authors": are not configurable at all

Shouldn't the "name" correlate to the packageName setting inadditional-properties?
The other properties are all accessible through the info object in the yaml specification.

    {{#composerPackageName}}
    "name": "{{.}}",
    {{/composerPackageName}}
    {{#artifactVersion}}
    "version": "{{.}}",
    {{/artifactVersion}}
    "description": "{{{appDescription}}}",
    "keywords": [
        "openapitools",
        "openapi-generator",
        "openapi",
        "php",
        "sdk",
        "rest",
        "api"
    ],
    "homepage": "https://openapi-generator.tech",
    "license": "unlicense",
    "authors": [
        {
            "name": "OpenAPI-Generator contributors",
            "homepage": "https://openapi-generator.tech"
        }
    ]
openapi-generator version

openapi-generator-cli 6.3.0

OpenAPI declaration file content or url
info:
  description: >-
    My description
  version: 4.1.0
  title: My title
  license:
    name: Proprietary
Generation Details

openapi-generator-cli generate -i openapi/openapi.yaml -g php -o clients/php --additional-properties artifactVersion=4.1.0,packageName=my/package,invokerPackage=MyPackage\\Client --global-property skipFormModel=false

Steps to reproduce
Related issues/PRs
Suggest a fix

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions