Skip to content

feat: add TOML v1.0 serialization support#2828

Open
Thyago-Oliveira-Perez wants to merge 1 commit intomicrosoft:mainfrom
Thyago-Oliveira-Perez:feature/toml-feature
Open

feat: add TOML v1.0 serialization support#2828
Thyago-Oliveira-Perez wants to merge 1 commit intomicrosoft:mainfrom
Thyago-Oliveira-Perez:feature/toml-feature

Conversation

@Thyago-Oliveira-Perez
Copy link
Copy Markdown

   Adds OpenApiTomlWriter (mirrors OpenApiJsonWriter / OpenApiYamlWriter),
   a new OpenApiConstants.Toml constant, and SerializeAsTomlAsync extension
   methods so callers can export an OpenAPI document as TOML.

   Public API declared in PublicAPI.Unshipped.txt; RS0026 suppressed for
   consistency with existing SerializeAsJson/YamlAsync overloads.

Pull Request

Description

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Other (please describe):

Related Issue(s)

Changes Made

  • Added OpenApiTomlWriter to support writing OpenAPI documents in TOML format
  • Introduced OpenApiConstants.Toml constant
  • Added SerializeAsTomlAsync extension methods (string and stream overloads)
  • Integrated TOML into existing SerializeAsync format selection
  • Declared new public APIs in PublicAPI.Unshipped.txt
  • Suppressed RS0026 for consistency with existing JSON/YAML serialization methods
  • Added unit tests covering TOML writer behavior and serialization

Testing

Checklist

  • My code follows the code style of this project
  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Versions applicability

  • My change applies to the version 1.X of the library, if so PR link:
  • My change applies to the version 2.X of the library, if so PR link:
  • My change applies to the version 3.X of the library, if so PR link:
  • I have evaluated the applicability of my change against the other versions above.

See the contributing guidelines for more information about how patches are applied across multiple versions.

Additional Notes

       Adds OpenApiTomlWriter (mirrors OpenApiJsonWriter / OpenApiYamlWriter),
       a new OpenApiConstants.Toml constant, and SerializeAsTomlAsync extension
       methods so callers can export an OpenAPI document as TOML.

       Public API declared in PublicAPI.Unshipped.txt; RS0026 suppressed for
       consistency with existing SerializeAsJson/YamlAsync overloads.
@Thyago-Oliveira-Perez Thyago-Oliveira-Perez requested a review from a team as a code owner April 17, 2026 00:52
@Thyago-Oliveira-Perez
Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

Copy link
Copy Markdown
Member

@baywet baywet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @Thyago-Oliveira-Perez
Thank you for using the SDK and for reaching out.
Thanks for the contribution!

I'm a bit mixed on this proposal and wished you had started by creating an issue first to have a discussion.

OpenAPI descriptions are by design deeply nested, and TOML does not seem to be designed for that. Additionally, the ecosystem support for TOML, and demand for it is low to inexistant. (no prior issue on the matter)

As for this PR: I'm really questioning the usefulness of having the ability to serialize to, but not deserialize from TOML. I understand this might be useful to convert and push to other systems that only accept TOML, but I'd be surprised to see any system that only accepts TOML in 2026. Implementing the deserialization would need to be done in a companion library like yaml is done today. And would allow us to validate roundtrips actually work.

Before we make any further code changes, can you please expand on why you think TOML is necessary? Why it needs to be in the "official library" (and not in a community owned peer)? And what you're trying to achieve (beyond supporting TOML)?

Thanks!

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