Skip to content

Conversation

Copilot
Copy link

@Copilot Copilot AI commented Oct 2, 2025

Overview

This PR implements the XML Object updates specified in OpenAPI 3.2.0 specification, introducing a new NodeType property while maintaining backward compatibility with earlier OpenAPI versions.

Changes

New Functionality

  • Added OpenApiXmlNodeType enum with five values:

    • Element - represents XML element nodes
    • Attribute - represents XML attribute nodes
    • Text - represents text nodes
    • Cdata - represents CDATA sections
    • None - represents no specific node type
  • Added NodeType property to OpenApiXml class for explicit XML node type specification

Backward Compatibility

The existing Attribute and Wrapped boolean properties are now marked as obsolete but remain fully functional:

  • Attribute property (obsolete):

    • Getter returns true when NodeType == OpenApiXmlNodeType.Attribute
    • Setter sets NodeType to Attribute when true, None when false
  • Wrapped property (obsolete):

    • Getter returns true when NodeType == OpenApiXmlNodeType.Element
    • Setter sets NodeType to Element when true, None when false

Version-Specific Serialization

The serialization behavior now depends on the OpenAPI specification version:

OpenAPI 3.2.0 and above:

{
  "name": "item",
  "nodeType": "element"
}

OpenAPI 3.1.0 and below:

{
  "name": "item",
  "wrapped": true
}

This ensures documents remain compatible with their target specification version.

Deserialization Support

All deserializers (V2, V3, V3.1, V32) have been updated:

  • V32 deserializer now handles the nodeType field
  • Earlier version deserializers continue to support attribute and wrapped fields
  • Both old and new properties can be read, ensuring forward and backward compatibility

Testing

  • Added 5 new tests covering NodeType serialization in different OpenAPI versions
  • All existing 1,364 tests continue to pass
  • Public API file updated to reflect the new enum and obsolete attributes

Example Usage

// New approach (OpenAPI 3.2.0+)
var xml = new OpenApiXml
{
    Name = "pet",
    NodeType = OpenApiXmlNodeType.Element
};

// Legacy approach (still works, but marked obsolete)
#pragma warning disable CS0618
var xml = new OpenApiXml
{
    Name = "attr",
    Attribute = true
};
#pragma warning restore CS0618

Fixes microsoft#89

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:

  • example.org926f4f21-88e7-4dc5-bf88-6c529bb77844
    • Triggering command: /usr/share/dotnet/dotnet exec --runtimeconfig /home/REDACTED/work/OpenAPI.NET/OpenAPI.NET/test/Microsoft.OpenApi.Hidi.Tests/bin/Release/net8.0/Microsoft.OpenApi.Hidi.Tests.runtimeconfig.json --depsfile /home/REDACTED/work/OpenAPI.NET/OpenAPI.NET/test/Microsoft.OpenApi.Hidi.Tests/bin/Release/net8.0/Microsoft.OpenApi.Hidi.Tests.deps.json /home/REDACTED/work/OpenAPI.NET/OpenAPI.NET/test/Microsoft.OpenApi.Hidi.Tests/bin/Release/net8.0/testhost.dll --port 42855 --endpoint 127.0.0.1:042855 --role client --parentprocessid 5384 --telemetryoptedin false (dns block)

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

Original prompt

This section details on the original issue you should resolve

<issue_title>xmlObject fields updates</issue_title>
<issue_description>OAI 3.2.0 makes a few updates to the XML object

  • Add a new enum named OpenApiXmlNodeType (element, attribute, text, cdata, or none)
  • Add a new property called NodeType
  • Mark the Attribute property as obsolete
  • Make the Attribute property getter evaluate whether the NodeType property is set to attribute
  • Make the Attribute property setter set the NodeType property to attribute when true, none when false
  • DO NOT serialize the attribute property in 3.2.0, but serialize it in 3.1.0
  • Mark the Wrapped property as obsolete
  • Make the Wrapped property getter evaluate whether NodeType is set to element
  • Make the Wrapped property setter set the NodeType property to element when true, none when false
  • DO NOT serialize the wrapped property in 3.2.0, but serialize it in 3.1.0
  • DO NOT serialize the NodeType property in 3.1.0 or below.</issue_description>

<agent_instructions>make sure you update the public api export</agent_instructions>

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

Fixes #11

💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Co-authored-by: baywet <7905502+baywet@users.noreply.github.com>
@Copilot Copilot AI changed the title [WIP] xmlObject fields updates Add OpenApiXmlNodeType enum and update OpenApiXml for OAI 3.2.0 support Oct 2, 2025
@Copilot Copilot AI requested a review from baywet October 2, 2025 16:49
Copilot finished work on behalf of baywet October 2, 2025 16:49
baywet added 6 commits October 2, 2025 13:37
Signed-off-by: Vincent Biret <vibiret@microsoft.com>
…void any confusion with the new node type property

Signed-off-by: Vincent Biret <vibiret@microsoft.com>
Signed-off-by: Vincent Biret <vibiret@microsoft.com>
Signed-off-by: Vincent Biret <vibiret@microsoft.com>
Signed-off-by: Vincent Biret <vibiret@microsoft.com>
@baywet baywet marked this pull request as ready for review October 2, 2025 19:10
@baywet baywet enabled auto-merge October 2, 2025 19:10
@baywet baywet merged commit fdb9548 into feat/oai-3-2-support Oct 2, 2025
6 checks passed
@baywet baywet deleted the copilot/fix-89dde62e-35c4-4c9f-b72a-053e29c52169 branch October 2, 2025 19:15
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.

xmlObject fields updates

3 participants