Skip to content

Mark stored procedure parameters without defaults as required in OpenAPI#3687

Draft
Copilot wants to merge 2 commits into
mainfrom
copilot/fix-openapi-required-params
Draft

Mark stored procedure parameters without defaults as required in OpenAPI#3687
Copilot wants to merge 2 commits into
mainfrom
copilot/fix-openapi-required-params

Conversation

Copilot AI commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Why make this change?

  • Closes [Bug]: Required params not marked in OpenAPI #3498. The generated OpenAPI document for stored procedure entities omitted the required array on the {entity}_sp_request schema, so parameters that must be supplied (e.g. firstName, lastName) were not flagged as required.

What is this change?

  • CreateSpRequestComponentSchema (OpenApiDocumentor.cs): a parameter is now marked required when it is explicitly flagged in config or has no default value. Previously only an explicit config required: true populated the array, which is almost never set, so the array was always empty.
    • Mirrors the existing IsRequestBodyRequired logic (!HasConfigDefault), keeping body-level and property-level required semantics consistent. An explicit config required: false is still honored.
if (def.Required ?? !def.HasConfigDefault)
{
    required.Add(parameter);
}

How was this tested?

  • Integration Tests
  • Unit Tests

Extended StoredProcedureGeneration.ValidateRequestBodyContents to assert the request body schema's required set contains the expected parameters. Verified the assertion fails when the fix is reverted.

Sample Request(s)

GET /api/openapi — request body schema component for a stored procedure with parameters title, publisher_name (neither having a default):

"sp1_sp_request": {
  "type": "object",
  "properties": {
    "title": { "type": "string" },
    "publisher_name": { "type": "string" }
  },
  "required": [ "title", "publisher_name" ]
}

Copilot AI changed the title [WIP] Fix required params not marked in OpenAPI schema Mark stored procedure parameters without defaults as required in OpenAPI Jun 26, 2026
Copilot AI requested a review from souvikghosh04 June 26, 2026 08:24
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.

[Bug]: Required params not marked in OpenAPI

2 participants