Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 7, 2025

Adds missing test coverage for the SpreadRecordNonDiscriminatedUnion3 scenario from http-specs (Record<WidgetData2[] | WidgetData1>).

Changes

  • Added two SpectorTest methods in AdditionalPropertiesTests.cs:
    • SpreadRecordNonDiscriminatedUnion3Get: Tests GET with heterogeneous union type additional properties
    • SpreadRecordNonDiscriminatedUnion3Put: Tests PUT with the same model

Implementation Details

The union type Record<WidgetData2[] | WidgetData1> generates IDictionary<string, BinaryData> where values can be arrays or single objects:

// Array serialization - arrays don't implement IJsonModel<T>
["prop1"] = BinaryData.FromObjectAsJson(new[] { 
    new WidgetData2("2021-01-01T00:00:00Z"),
    new WidgetData2("2021-01-01T00:00:00Z")
})

// Single object serialization
["prop2"] = ModelReaderWriter.Write(new WidgetData1(...))

Deserialization uses ToObjectFromJson<WidgetData2[]>() for arrays and ModelReaderWriter.Read<WidgetData1>() for single objects.

Original prompt

This section details on the original issue you should resolve

<issue_title>Adopt new Type/Property/additional-property scenarios</issue_title>
<issue_description>There are several new scenarios here that we would need to adopt by adding the corresponding SpectorTests.</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI changed the title [WIP] Add SpectorTests for new additional property scenarios Add SpectorTests for SpreadRecordNonDiscriminatedUnion3 scenario Nov 7, 2025
Copilot finished work on behalf of JoshLove-msft November 7, 2025 01:16
@JoshLove-msft
Copy link
Contributor

@copilot the spector tests are failing. can you please investigate the issue?

Copy link
Contributor Author

Copilot AI commented Nov 12, 2025

@copilot the spector tests are failing. can you please investigate the issue?

I've investigated the tests and found that:

  1. The http-specs e2e tests for SpreadRecordNonDiscriminatedUnion3 are passing
  2. The C# SpectorTests I added compile successfully
  3. The SpectorTests are being skipped locally because the generated client code is stubbed (which is expected for checked-in code)

Could you provide more details about which specific tests are failing in CI? Are you seeing:

  • Build failures?
  • Test execution failures?
  • Coverage check failures?

This will help me identify and fix the exact issue.

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:

  • telemetry.astro.build
    • Triggering command: node /home/REDACTED/work/typespec/typespec/website/node_modules/.bin/../astro/astro.js build (dns block)

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

Copilot finished work on behalf of JoshLove-msft November 12, 2025 00:33
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.

Adopt new Type/Property/additional-property scenarios

2 participants