Repository navigation
Generate descriptions for undocumented enum cases - #1323
Merged
romalytvynenko merged 2 commits intoNov 6, 2026
Merged
Conversation
romalytvynenko
deleted the
feat/add-enum_cases_auto_description_strategy
branch
November 6, 2026 15:34
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Added
enum_cases_auto_description_strategyconfig option which allows to automatically document enum cases using their names.For example:
As is, this enum will be documented as this JSON schema:
{ "type": "string", "enum": ["1", "2-10", "11-50", "51+"], "title": "CompanySize" }While this is a valid JSON schema, it lacks enum names. So you can add them via PHPDoc:
Given
enum_cases_description_strategyoption is set to'description':{ "type": "string", "enum": ["1", "2-10", "11-50", "51+"], "x-enumDescriptions": { "1": "Single", "2-10": "Small", "11-50": "Medium", "51+": "Large" }, "title": "CompanySize" }But providing description that is literally the same as the enum case name is a bit... repetitive.
The new config option,
enum_cases_auto_description_strategy, allows to get the description automatically from enum names without adding repetitive PHPDoc.Available options:
title: enum namedLARGE_COMPANYgetsLarge Companydescription in OpenAPIsentence: enum namedLARGE_COMPANYgetsLarge companydescription in OpenAPIas_is: enum namedLARGE_COMPANYremainsLARGE_COMPANYdescription in OpenAPIIn case you provide PHPDoc for the case, just content of PHPDoc will be used.