Skip to content

Extends OpenAPISpecGeneratorPlugin to include default values for parameters#1323

Merged
waldekmastykarz merged 7 commits into
dotnet:mainfrom
bartizan:feat/1110_include-default-values-for-params-OpenAPIGenerator
Jul 14, 2025
Merged

Extends OpenAPISpecGeneratorPlugin to include default values for parameters#1323
waldekmastykarz merged 7 commits into
dotnet:mainfrom
bartizan:feat/1110_include-default-values-for-params-OpenAPIGenerator

Conversation

@bartizan
Copy link
Copy Markdown
Contributor

@bartizan bartizan marked this pull request as ready for review July 11, 2025 12:12
@bartizan bartizan requested a review from a team as a code owner July 11, 2025 12:12
@waldekmastykarz waldekmastykarz requested a review from Copilot July 13, 2025 13:17
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Extends the OpenAPI spec generator plugin to allow configuring which query parameters to include in the spec and automatically set their default values.

  • Adds a new includeParameters array option to the plugin’s JSON schema.
  • Introduces IncludeParameters in the plugin configuration class with a default empty collection.
  • Updates parameter processing logic to mark included parameters as required and assign their default values.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
schemas/v1.0.0/openapispecgeneratorplugin.schema.json Introduces the includeParameters property to the JSON schema
DevProxy.Plugins/Generation/OpenApiSpecGeneratorPlugin.cs Adds IncludeParameters config field and logic for defaults
Comments suppressed due to low confidence (1)

DevProxy.Plugins/Generation/OpenApiSpecGeneratorPlugin.cs:346

  • The new default-value logic (SetParameterDefault) and inclusion behavior lack unit tests. Add tests to verify that parameters listed in IncludeParameters are marked required and have their Schema.Default set correctly.
    private static void SetParameterDefault(OpenApiParameter parameter, object? value)

Comment thread schemas/v1.0.0/openapispecgeneratorplugin.schema.json Outdated
Comment thread DevProxy.Plugins/Generation/OpenApiSpecGeneratorPlugin.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Collaborator

@waldekmastykarz waldekmastykarz left a comment

Choose a reason for hiding this comment

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

Works like a charm. Nothing to add 👏

@waldekmastykarz waldekmastykarz enabled auto-merge (squash) July 14, 2025 06:37
@waldekmastykarz waldekmastykarz merged commit 0f949b0 into dotnet:main Jul 14, 2025
4 checks passed
@bartizan bartizan deleted the feat/1110_include-default-values-for-params-OpenAPIGenerator branch July 14, 2025 06:43
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.

3 participants