You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[feat] Allow configuration of yaml minimize quotes (#5933)
There are cases where minimizing quotes results in invalid YAML. For
example, an input YAML with string "1234_1234" will be converted to YAML
value 1234_1234 which is an int in YAML 1.1
(https://yaml.org/type/int.html)
THe only option in these cases is to either:
* Revert the option completely to always quote values
* Provide a user-customization to disable quotes minimization
This applies the latter with the assumption that this is an edge case
and users who are unaffected will default to the "prettier" version.
An alternative would be to write a custom serializer for strings, and if
they are in the format of of any of the valid formats defined in YAML:
[-+]?0b[0-1_]+ # (base 2)
|[-+]?0[0-7_]+ # (base 8)
|[-+]?(0|[1-9][0-9_]*) # (base 10)
|[-+]?0x[0-9a-fA-F_]+ # (base 16)
|[-+]?[1-9][0-9_]*(:[0-5]?[0-9])+ # (base 60)
Then wrap the result in quotes. That approach was not taken because of
the potential for significant performance impact on very large specs,
which our users are often tasked with transforming.
Copy file name to clipboardExpand all lines: modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonAbstractConnexionServerCodegen.java
+1Lines changed: 1 addition & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -594,6 +594,7 @@ public Map<String, Object> postProcessSupportingFileData(Map<String, Object> obj
594
594
}
595
595
}
596
596
597
+
generateJSONSpecFile(objs);
597
598
generateYAMLSpecFile(objs);
598
599
599
600
for (Map<String, Object> operations : getOperations(objs)) {
0 commit comments