Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix OpenAPI YAML converts strings to boolean #5456

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

wanlwanl
Copy link
Member

@wanlwanl wanlwanl commented Dec 27, 2024

Problem: yaml 1.1 treats some string as other types of value. Check out: https://perlpunk.github.io/yaml-test-schema/schemas.html
Fix: #5377
Solution: make serialization compatible with YAML 1.1
Todo: test other types (in next PR).

@microsoft-github-policy-service microsoft-github-policy-service bot added the emitter:openapi3 Issues for @typespec/openapi3 emitter label Dec 27, 2024
@wanlwanl wanlwanl enabled auto-merge December 27, 2024 05:39
@wanlwanl wanlwanl requested a review from chrisradek December 27, 2024 05:39
@azure-sdk
Copy link
Collaborator

azure-sdk commented Dec 27, 2024

All changed packages have been documented.

  • @typespec/openapi3
Show changes

@typespec/openapi3 - fix ✏️

Fix: OpenAPI YAML converts strings to boolean

@azure-sdk
Copy link
Collaborator

You can try these changes here

🛝 Playground 🌐 Website 📚 Next docs 🛝 VSCode Extension

@wanlwanl wanlwanl changed the title fix Fix Problem of YAML 1.1 Treats Some String as Other Types of Values Dec 27, 2024
@wanlwanl wanlwanl changed the title Fix Problem of YAML 1.1 Treats Some String as Other Types of Values Fix Problem of YAML 1.1 Treats Some Strings as Other Types of Values Dec 27, 2024
@wanlwanl wanlwanl changed the title Fix Problem of YAML 1.1 Treats Some Strings as Other Types of Values Fix OpenAPI YAML converts strings to boolean Dec 27, 2024
Copy link
Member

@timotheeguerin timotheeguerin left a comment

Choose a reason for hiding this comment

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

I don’t think we should do that, there was already a discussion about this. Openapi recommend using yaml 1.2 we shouldn’t try to use 1.1 at least by default.

In order to preserve the ability to round-trip between YAML and JSON formats, YAML version 1.2 is RECOMMENDED along with some additional constraints

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
emitter:openapi3 Issues for @typespec/openapi3 emitter
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: OpenAPI YAML converts strings to boolean
3 participants