Skip to content

[repo-assist] test: OperationCompiler response-type tests for component $ref and array responses (+5 tests, 468→473)#450

Open
github-actions[bot] wants to merge 5 commits into
masterfrom
repo-assist/test-op-response-types-20260524-1b07474bd6d73b8d
Open

[repo-assist] test: OperationCompiler response-type tests for component $ref and array responses (+5 tests, 468→473)#450
github-actions[bot] wants to merge 5 commits into
masterfrom
repo-assist/test-op-response-types-20260524-1b07474bd6d73b8d

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

🤖 This PR was created by Repo Assist, an automated AI assistant.

Summary

Adds 8 new [<Fact>] tests (5 net new test cases in the runner) covering the interaction between DefinitionCompiler and OperationCompiler when response schemas use $ref to component types.

What's tested

GET returning a single component $ref (/pets/{id}Task<Pet>):

  • Verifies the return type is Task<T> where T is the compiled Pet ProvidedType (not Task<unit> or Task<string>)
  • Verifies the Pet schema is compiled as a named type
  • Verifies the Pet type has its declared properties

GET returning array-of-$ref (/petsTask<Pet[]>):

  • Verifies the return type is Task<T[]> (array return type)
  • Verifies the array element type is the component schema type by name

POST with 201 response using $ref (createPetTask<Pet>):

  • Verifies the 201 response is used (not Task<unit>)
  • Verifies the return type is the component schema type
  • Verifies the request body parameter type is the NewPet component schema type

Why this matters

Existing tests (e.g. the PUT endpoint test) only check that the return type is not unit. They do not verify that the return type is the specific component schema that was referenced. These new tests close that gap and provide confidence that the type threading between DefinitionCompiler and OperationCompiler works correctly for common real-world API patterns (single resource GET, collection GET, POST-and-return).

Test Status

Total: 473, Errors: 0, Failed: 0, Skipped: 1, Time: 0.929s

All 473 tests pass (468 before → 473 after).

Generated by 🌈 Repo Assist, see workflow run. Learn more.

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@dcdf09723d42ef9b6c75335e4612fd145d4ccdaa

…d array responses (+5 tests, 468->473)

- GET returning $ref to component schema: verifies return type is Task<ComponentType>, not
  Task<unit>, and that the referenced schema is compiled as a named type with its properties
- GET returning array-of-$ref: verifies return type is Task<ComponentType[]> and element type name
- POST with 201 $ref response: verifies return type is Task<ComponentType> (not Task<unit>)
  and that the request body parameter type is the NewPet component schema type

These tests cover the important cross-compiler interaction where OperationCompiler consumes
component schemas that DefinitionCompiler compiled, verifying the return-type threading works.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@sergey-tihon sergey-tihon marked this pull request as ready for review May 25, 2026 06:10
Copilot AI review requested due to automatic review settings May 25, 2026 06:10
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

Adds additional unit-test coverage in Schema.OperationCompilationTests to validate that OperationCompiler correctly threads response schemas that are $ref’d component types (including arrays and 201-created responses) into generated Task<...> method return types and request-body parameter types.

Changes:

  • Added tests for GET responses returning a single component $ref (Task<Pet>) and array-of-$ref (Task<Pet[]>).
  • Added tests for POST with a 201 response using a $ref body (Task<Pet>) and request body $ref parameter (NewPet).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/SwaggerProvider.Tests/Schema.OperationCompilationTests.fs
Comment thread tests/SwaggerProvider.Tests/Schema.OperationCompilationTests.fs
Comment thread tests/SwaggerProvider.Tests/Schema.OperationCompilationTests.fs
Comment thread tests/SwaggerProvider.Tests/Schema.OperationCompilationTests.fs
@sergey-tihon
Copy link
Copy Markdown
Member

@copilot address inline comments

Copy link
Copy Markdown
Contributor

Copilot AI commented May 25, 2026

@copilot address inline comments

Addressed the inline review comments in commit 0d25bdd: added explicit shouldNotEqual typeof<obj>, asserted both Name and Age on Pet, guarded array element type assertion with IsArray, and added parameter count/CancellationToken assertions before checking the body param type.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • petstore.swagger.io
    • Triggering command: /usr/share/dotnet/dotnet /usr/share/dotnet/dotnet /usr/share/dotnet/sdk/10.0.300/FSharp/fsc.dll @/tmp/MSBuildTempG6RpA9/tmp8f786405cd004210b613599907c641b4.rsp (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI requested a review from sergey-tihon May 25, 2026 10:19
@sergey-tihon
Copy link
Copy Markdown
Member

@copilot fix link

Copy link
Copy Markdown
Contributor

Copilot AI commented May 25, 2026

@copilot fix link

Updated with a direct link to the change: 0d25bdd

@sergey-tihon
Copy link
Copy Markdown
Member

@copilot fix the build, format code

Co-authored-by: sergey-tihon <1197905+sergey-tihon@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI commented May 25, 2026

@copilot fix the build, format code

Done in b778365: ran formatting (Format/CheckFormat) and no file changes were needed; then pushed this commit to retrigger the Build and Test workflow.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • petstore.swagger.io
    • Triggering command: /usr/share/dotnet/dotnet /usr/share/dotnet/dotnet /usr/share/dotnet/sdk/10.0.300/FSharp/fsc.dll @/tmp/MSBuildTempMTWyWU/tmp4e431958becd4d77b8892cd22932eefd.rsp (dns block)
    • Triggering command: /usr/share/dotnet/dotnet /usr/share/dotnet/dotnet /usr/share/dotnet/sdk/10.0.300/FSharp/fsc.dll @/tmp/MSBuildTempZ153PR/tmp2264a7615c3c4d32a9f941bf987bced4.rsp (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants