Skip to content

[BUG][PHP] Too verbose PHPDoc blocks in each file #7530

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

Open
5 of 6 tasks
dkarlovi opened this issue Sep 28, 2020 · 4 comments
Open
5 of 6 tasks

[BUG][PHP] Too verbose PHPDoc blocks in each file #7530

dkarlovi opened this issue Sep 28, 2020 · 4 comments

Comments

@dkarlovi
Copy link
Contributor

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

Current,y the php generator produces files with very large headers, close to or exceeding 40 lines. Not only is that way too verbose, it actually lowers the quality of the code since the signal/noise ratio is way off.

This can also be seen in other places where the information is repeated in the PHPDoc block and immediately following it in code, bringing no value.

Solution proposals

  • merge information from multiple file PHPDoc blocks into a single shorter one, not repeating itself, take into account code style fixers can change/remove them and design accordingly (for example, one file level one with the the data currently in partial_header.mustache, one class level one, example below)
  • remove PHPDoc comments which just repeat the informaton already obvious from the method APIs: if you have a PHPDoc, it should create value, if it's just repeating the same information, it's not doint that

Example

<?php

/**
 * Reddit.com.
 *
 * Reddit.com API
 *
 * The version of the OpenAPI document: 1.0.0
 *
 * Generated by: https://openapi-generator.tech
 * OpenAPI Generator version: 5.0.0-SNAPSHOT
 */

namespace Flexolabs\RedditClient;

use Exception;

/**
 * @author OpenAPI Generator team
 * @see    https://openapi-generator.tech
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 */
class ApiException extends Exception
{
}
@wing328
Copy link
Member

wing328 commented Oct 3, 2020

Your suggestion to reduce duplicated comments sound good to me.

@dkarlovi
Copy link
Contributor Author

Need to strip out comments mentioning the generator (or its team) as "authors", see: https://github.com/OpenAPITools/openapi-generator#34---license-information-on-generated-code

@wing328
Copy link
Member

wing328 commented Oct 20, 2020

The below is more for growth-hacking to introduce openapi-generator to more users.

 * @author OpenAPI Generator team
 * @see    https://openapi-generator.tech

Auto-generated code in other languages (e.g. Ruby) also put down "OpenAPI Generator team" as the author

@dkarlovi
Copy link
Contributor Author

@wing328 understandable, but since the code ships without a license by default, as established in #7535 and the generated code claims authorship by the generator team, that's at least something to consider.

The generator can be mentioned without it (or its team) being explicitly called the authors of the generated code, those two things seem very different, but IANAL.

Something like "generated with" instead of "author", the author is the user running the tool, no?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants