Skip to content

feat(openapi): add backed enum support#5120

Merged
alanpoulain merged 1 commit into
api-platform:mainfrom
alanpoulain:feat/openapi-enum-support
Nov 7, 2022
Merged

feat(openapi): add backed enum support#5120
alanpoulain merged 1 commit into
api-platform:mainfrom
alanpoulain:feat/openapi-enum-support

Conversation

@alanpoulain

Copy link
Copy Markdown
Member

Supersedes #4857.

Partially fixes #2254.

@alanpoulain alanpoulain force-pushed the feat/openapi-enum-support branch from f4c541a to 6cf2146 Compare November 7, 2022 16:19
@alanpoulain alanpoulain merged commit f1ecc30 into api-platform:main Nov 7, 2022
$enumType = new Type(Type::BUILTIN_TYPE_OBJECT, $nullable, $enumClass);
}

switch ($typeOfField) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't we use match here ?

$typeOfField = $metadata->getTypeOfField($property);
$nullable = $metadata instanceof MongoDbClassMetadata && $metadata->isNullable($property);
$enumType = null;
if (null !== $enumClass = $metadata instanceof MongoDbClassMetadata ? $metadata->getFieldMapping($property)['enumType'] ?? null : null) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we try to avoid multiple conditions in an if

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support for Enums

2 participants