Skip to content

Extends OpenAPISpecGeneratorPlugin to include default values for parameters #1323

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

Conversation

bartizan
Copy link
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
Contributor

@Copilot 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)

Copy link
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.

2 participants