Skip to content

Support schema.requiredMode on ParameterObject #2200

Closed
@uc4w6c

Description

@uc4w6c

If you ❤️ this project consider becoming a sponsor.
If you already use the springdoc-openapi, please do not forget adding a github star to this repository.

Is your feature request related to a problem? Please describe.

I want to use schema.requiredMode on ParameterObject too.

example

  @GetMapping
  public String index(@ParameterObject Request request) {
    return null;
  }

  record Request(
      @Schema(requiredMode = Schema.RequiredMode.REQUIRED)
      String id
  ) {}

current

"parameters": [
	{
		"name": "id",
		"in": "query",
		"required": false,
		"schema": {
			"type": "string"
		}
	}
],

expected

"parameters": [
	{
		"name": "id",
		"in": "query",
		"required": true,
		"schema": {
			"type": "string"
		}
	}
],

Describe the solution you'd like

Same as above

Describe alternatives you've considered

  • A clear and concise description of any alternative solutions or features you've
    considered.

Additional context

  • Add any other context or screenshots about the feature request here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions