-
Notifications
You must be signed in to change notification settings - Fork 243
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]: Illegal characters in component keys (Swagger) #3889
Comments
Hi @flexwie can you show where it says having those are not allowed in swagger? You are talking about the parameter called $take? I pasted the resulting openapi in editor.swagger.io and there was no issues |
Sorry, it seems like the playground link was not up to date. Please try again with this example: |
OAS3 emitter should follow https://datatracker.ietf.org/doc/html/rfc3986#section-2.2 to validate the characters |
All the fixed fields declared above are objects that MUST use keys that match the regular expression: ^[a-zA-Z0-9.-_]+$. Field Name Examples:
|
… ^[a-zA-Z0-9.-_]+$. (#5006) fix #3889 --------- Co-authored-by: Kyle Zhang <[email protected]> Co-authored-by: Mark Cowlishaw <[email protected]>
Describe the bug
If you define a component with keys that include a character outside of
[A-Z a-z 0-9 - . _]
the corresponding key in the OpenAPI definition will contain that character even if its not allowed by swagger (paste result here).Is there some way to remove the characters from the generated key as a workaround?
Reproduction
https://typespec.io/playground?c=aW1wb3J0ICJAdHlwZXNwZWMvaHR0cCI7CtIZcmVzdNUZb3BlbmFwaTMiOwoKdXNpbmcgVHlwZVNwZWMuSHR0cDsKCgpAc2VydmljZSh7CiAgICB0aXRsZTogIlTEUwp9KQpAcm91dGUoIi8iKQpuYW1lc3BhY2UgRW5kcG9pbnRzIMY3QGdldMYJdGFnKCJsaXN0IinFEW9wIMQOKC4uLkNvbW1vblBhcmFtZXRlcnMpOiBzdHJpbmc7Cn0KCm1vZGVsINAkyGBxdWVyecULJHRha2U%2FOiBpbnQzMjsKfQ%3D%3D&e=%40typespec%2Fopenapi3&options=%7B%7D
Checklist
The text was updated successfully, but these errors were encountered: