Skip to content

Fields with numeric consts default value are incorrectly marked as required #216

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
nickvergessen opened this issue Feb 25, 2025 · 2 comments
Labels
bug Something isn't working

Comments

@nickvergessen
Copy link
Member

nickvergessen commented Feb 25, 2025

Controller

	public function createRoomV2(
		string $name,
		int $type = Room::TYPE_GROUP,
		int $readOnly = Room::READ_WRITE,
		int $listable = Room::LISTABLE_NONE,
		int $messageExpiration = 0,
		int $lobbyState = Webinary::LOBBY_NONE,
		?int $lobbyTimer = null,
		int $sipEnabled = Webinary::SIP_DISABLED,
		int $permissions = Attendee::PERMISSIONS_DEFAULT,
		int $recordingConsent = RecordingService::CONSENT_REQUIRED_NO,
		int $mentionPermissions = Room::MENTION_PERMISSIONS_EVERYONE,
		string $description = '',
		?string $password = null,
		?string $objectType = null,
		?string $objectId = null,
		?string $emoji = null,
		?string $avatarColor = null,
		array $participants = [],
	): DataResponse {

Expectation

Only name is marked as required

Actual

Also fields with consts as default are marked as required

Image

@nickvergessen nickvergessen added the bug Something isn't working label Feb 25, 2025
@nickvergessen nickvergessen changed the title Fields with numeric default value are incorrectly marked as required Fields with numeric consts default value are incorrectly marked as required Feb 25, 2025
@provokateurin
Copy link
Member

Ignore my deleted comment, I didn't read the issue correctly.

Because we can't parse the default value, we treat it like there is no default value.
I'm not sure if we should change this, but I guess we could since we not there will at least be some default value even if we don't know which one exactly.

The better way to solve this would be to support constants (both in code and phpdoc). That would make a bunch of things easier, but might require a non trivial amount of work to implement.

@nickvergessen
Copy link
Member Author

Because we can't parse the default value, we treat it like there is no default value.
I'm not sure if we should change this, but I guess we could since we not there will at least be some default value even if we don't know which one exactly.

The better way to solve this would be to support constants (both in code and phpdoc). That would make a bunch of things easier, but might require a non trivial amount of work to implement.

Exactly my train of thoughts :D

Okay, then let's see if we can temporarily add a "not-required" flag somehow, until consts work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants