Skip to content

Params with default constant marked as required #284

@Antreesy

Description

@Antreesy

How to use GitHub

  • Please use the 👍 reaction to show that you are affected by the same issue.
  • Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this issue.
  • Subscribe to receive notifications on status change and new comments.

Steps to reproduce

  1. Define arguments as optional
  2. Set default value as externally defined constant and not primitive (string, int)
  3. Run composer to generate JSON

Expected behaviour

Idea from @nickvergessen : if parser can not resolve the variable, it still should exclude the argument from the list of required args

Actual behaviour

See example in Talk: RoomController#createRoom

int $readOnly = Room::READ_WRITE,
int $listable = Room::LISTABLE_NONE,
int $messageExpiration = 0,

https://github.com/nextcloud/spreed/blob/5d31d3725614523d34276c4bbac830540a3c34c0/lib/Controller/RoomController.php#L646-L648

All of them accept integers, but only messageExpiration is given a 0 default

"schema": {
    "type": "object",
    "required": [
        "roomType",
        "readOnly",
        "listable",
        "lobbyState",
        "sipEnabled",
        "permissions",
        "recordingConsent",
        "mentionPermissions"
    ],

https://github.com/nextcloud/spreed/blob/5d31d3725614523d34276c4bbac830540a3c34c0/openapi.json#L14857-L14866

readOnly and listable are required, messageExpiration is not

"readOnly": {
    "type": "integer",
    "format": "int64",
    "enum": [
        0,
        1
    ],
    "description": "Read only..."
},
"listable": {
    "type": "integer",
    "format": "int64",
    "enum": [
        0,
        1,
        2
    ],
    "description": "Scope where ..."
},
"messageExpiration": {
    "type": "integer",
    "format": "int64",
    "default": 0,
    "description": "Seconds after ...",
    "minimum": 0
},

https://github.com/nextcloud/spreed/blob/5d31d3725614523d34276c4bbac830540a3c34c0/openapi.json#L14905-L14930

only messageExpiration have default value

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions