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

[Bug]: OpenAPI3 fails to consistently emit default float values declared in e-notation. #4419

Closed
4 tasks done
ethall opened this issue Sep 12, 2024 · 3 comments · Fixed by #4420
Closed
4 tasks done
Labels
bug Something isn't working emitter:openapi3 Issues for @typespec/openapi3 emitter

Comments

@ethall
Copy link

ethall commented Sep 12, 2024

Describe the bug

OpenAPI3 does not always emit a default float value when declared in e-notation.

When attempting to declare a default float, float32, or float64 less than 0.1, the emitter will drop the default field from the model.

Reproduction

Current behavior from v0.60.0:
Playground Link

Expected behavior from v0.56.0:
Playground Link

Checklist

@ethall ethall added the bug Something isn't working label Sep 12, 2024
@timotheeguerin timotheeguerin added the emitter:openapi3 Issues for @typespec/openapi3 emitter label Sep 12, 2024
@timotheeguerin
Copy link
Member

Weird, also depends on which order you define things. 0.01 defined after 1e-2 will not work but before both work

https://typespec.io/playground?c=bW9kZWwgRU5vdGF0aW9uQmFzaWMgew0KICBjOiBmbG9hdCA9IDFlLTI7xBRkyhQwLjAxOw0KfQ0K&e=%40typespec%2Fopenapi3&options=%7B%7D&version=0.60.x

@ethall
Copy link
Author

ethall commented Oct 8, 2024

Sorry to resurrect, but I tested the release containing #4420 and found more test cases where the compiler fails to capture the e-notation values. Should I create a new issue or add to this issue?

@timotheeguerin
Copy link
Member

yeah can you open a new issue with all the new cases you found

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

Successfully merging a pull request may close this issue.

2 participants